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 |
|---|---|---|---|---|---|---|---|---|
6b16154932f96e152b536040797766812adffbbd | 0a8df6e72d3d24a203661739f72ef5e8fd4d4de0 | uditgaurav/litmus-e2e | /components/engine/annotation-check_test.go | Go | go | 5,198 | permissive | package engine
import (
"testing"
"github.com/litmuschaos/chaos-operator/pkg/apis/litmuschaos/v1alpha1"
"github.com/litmuschaos/litmus-e2e/pkg"
"github.com/litmuschaos/litmus-e2e/pkg/environment"
"github.com/litmuschaos/litmus-e2e/pkg/log"
"github.com/litmuschaos/litmus-e2e/pkg/types"
. "github.com/onsi/ginkgo... |
319af764f7cb55499f5ffcf6cd861e50f8c17247 | 37f6b378e21cf27e59d699a9bb8079fe5ee7e03f | stevekuznetsov/kubernetes | /vendor/github.com/coreos/etcd/raft/storage.go | Go | go | 8,341 | permissive | // Copyright 2015 The etcd 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 t... |
3e8614ed9c689ac6ce2c0b4142b2f72947480dc8 | 6060dd4737ed9cc23bfa015e00eed4455a433af5 | cebrains/jupiter | /pkg/server/xgrpc/server_test.go | Go | go | 5,054 | no_license | // Copyright 2020 Douyu
//
// 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 writin... |
11373514125294cade32934c4e5033b8d55331a3 | 9bbb013fe692e01f10dc18d1e0bcdbeca8a84c8f | thanhngch/leetcode | /10parentheses/main_test.go | Go | go | 1,642 | no_license | package main
import (
"fmt"
"io/ioutil"
"runtime"
"strings"
"testing"
"time"
)
type Case struct {
in string
want bool
}
func setupData() []Case {
data, err := ioutil.ReadFile("./test.txt")
if err != nil {
panic(err)
}
dataArray := strings.Split(string(data), "\n")
cases := []Case{}
for _, line :=... |
0aa45501b4173ee02814649e8728e50650ba3ddc | 2b0f162a1f653b345b148ef3bf8694fb23d61a83 | zionwu/alerting-api | /types/client/alerting/v1/zz_generated_slack_config.go | Go | go | 248 | permissive | package client
const (
SlackConfigType = "slackConfig"
SlackConfigFieldChannel = "channel"
SlackConfigFieldURL = "url"
)
type SlackConfig struct {
Channel string `json:"channel,omitempty"`
URL string `json:"url,omitempty"`
}
|
1006e93b198f1c20eb9d7502b24208a3a0998433 | 2339c13168612932b60fd1953a6e0404c9c3516b | aeciovc/go_image_search_service | /rabbitmq/invoker_test.go | Go | go | 3,107 | no_license | package rabbitmq
import (
"testing"
test "github.com/aeciovc/go-image-search/test"
"reflect"
)
func TestInvokerWithNoParamsStringResultMethodSuccess(t *testing.T) {
invoker := GetInvoker()
function := func() string{
return "hello"
}
result, err := invoker.Invoke(function)
test.Equals(t, err, nil)
test.... |
798d7974e8e097be5e8909685d25fc2a84daa721 | dbcf7b25ac98916053e2fb415cae428369d32bce | dkrieger/batcher | /lib/reap.go | Go | go | 2,625 | permissive | package batcher
import (
"github.com/dkrieger/redistream"
"github.com/go-redis/redis"
)
func (b *Batcher) ReapSome(entries []redistream.Entry, streamName string) ([]redistream.Entry, error) {
out := []redistream.Entry{}
for _, e := range entries {
val, err := b.redisClient.XPendingExt(&redis.XPendingExtArgs{
... |
8a0ec7debe1147f7cc4316a108881a367498bb48 | 37fc2e5de668daf0b726e1cd883f6a35151a8204 | samtake/ecology | /appgo/model/mysql/wechat_code.go | Go | go | 2,255 | permissive | package mysql
import (
"errors"
"fmt"
"os"
"path/filepath"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"github.com/i2eco/ecology/appgo/pkg/utils"
)
// 微信小程序码记录表
type WechatCode struct {
Id int
BookId int `orm:"unique"`
Path string `orm:"default()"`
}
func NewWechatCode() (code *Wech... |
acab65a01ad59752963de0f4cfdc75b148a04889 | e3eb56e8cea1f2cbf89d7384ca90d3c409c93d70 | genpsp/go-app | /services/src/services/item_test.go | Go | go | 9,345 | no_license | package services
import (
"firebase.google.com/go/v4/auth"
"github.com/genpsp/go-app/pkg/configs"
"github.com/genpsp/go-app/pkg/logger"
"github.com/genpsp/go-app/pkg/mock_pkgs"
appErr "github.com/genpsp/go-app/pkg/server/error"
"github.com/genpsp/go-app/pkg/utils"
"github.com/genpsp/go-app/services/src/handler/... |
aa419d94f78900cb1326ebab250cda8dfacb741c | 3a4e34c9ba05caa48b6e0b9b170b881956fa958c | appointment-octopus/auth | /core/authentication/jwt_backend.go | Go | go | 3,477 | permissive | package authentication
import (
"bufio"
"crypto/rsa"
"crypto/x509"
"encoding/json"
"encoding/pem"
"os"
"time"
"github.com/appointment-octopus/auth/core/db"
"github.com/appointment-octopus/auth/services/models"
"github.com/appointment-octopus/auth/settings"
jwt "github.com/dgrijalva/jwt-go"
"golang.org/x/c... |
92928c4d8f4e4a89921d430670abc03c01755818 | 85bf2b703ae4b7d39f66b4ac7892804e52cb47d7 | ysim/cook | /search.go | Go | go | 4,365 | permissive | package main
import (
"errors"
"fmt"
log "github.com/sirupsen/logrus"
"os"
"strings"
)
const (
q_kv_separator = ":"
q_value_or = ","
q_value_and = "+"
)
// For now, we will only allow positive matches (i.e. for matches and not
// non-matches).
type Constraint struct {
Terms []string
Relations... |
384c15ed9a511ac0881028fe8352fd46c19f5028 | f4a08bf7941f3461de4529db3cbc79ee364c38be | cloudfoundry-community/go-cfclient | /resource/task.go | Go | go | 3,418 | permissive | package resource
import "time"
type Task struct {
GUID string `json:"guid"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Name string `json:"name"`
// User-facing id of the task; this number is unique for every task associated with a given app
SequenceID int `j... |
ef42887bdd113d77e583c5d65051536677475c86 | 66427e33904179592b33638b63530611a5872f9a | nbrownus/nebula | /lighthouse_test.go | Go | go | 16,271 | permissive | package nebula
import (
"context"
"fmt"
"net"
"testing"
"github.com/slackhq/nebula/config"
"github.com/slackhq/nebula/header"
"github.com/slackhq/nebula/iputil"
"github.com/slackhq/nebula/test"
"github.com/slackhq/nebula/udp"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v2"
)
//TODO: Add a test to ... |
d7aee8f84dd6f89cb9d72c7ef7b853adec826e7b | f15889b40eae19707c46e497af5a3e3ff257d4a5 | LinuxSuRen/jenkins-cli | /app/cmd/user_edit_test.go | Go | go | 1,240 | permissive | package cmd
//func TestEditUser(t *testing.T) {
// RunEditCommandTest(t, EditCommandTest{
// Procedure: func(c *expect.Console) {
// c.ExpectString("Edit user description")
// c.SendLine("")
// go c.ExpectEOF()
// time.Sleep(time.Millisecond)
// c.Send("\x1b")
// c.SendLine(":wq!")
// },
// Test: func(s... |
e17e56c742abe560712121ddf9c638767306c510 | ec41fb21473f06679f77312253b597260e7f7360 | hackmushroom/faas-cli | /commands/deploy.go | Go | go | 19,010 | permissive | // Copyright (c) Alex Ellis 2017. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package commands
import (
"encoding/base64"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"path/filepath"
"strings"
"gopkg.in/yaml.v2"
"gi... |
528c0ec139fc64b4cdf057602f99830dcb63c085 | ab1e2aaf61df3085b84a4499879529d344f697e5 | brb/goleveldb | /leveldb/util.go | Go | go | 1,366 | permissive | // Copyright (c) 2012, Suryandaru Triandana <syndtr@gmail.com>
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package leveldb
import (
"fmt"
"sort"
"github.com/brb/goleveldb/leveldb/storage"
)
func shorten(str string) string {
i... |
e25b5fa74a35cbb347bd5d59b4c53b7e67a04dac | a40260dfd1c79bf718f82970881f40c3f512038b | bennyscetbun/gohttpscerthack | /test/main.go | Go | go | 1,964 | no_license | package main
import (
"bytes"
"crypto/rand"
"crypto/tls"
"crypto/x509"
"encoding/pem"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"strings"
"github.com/bennyscetbun/gohttpscerthack"
)
func usage() {
fmt.Fprintf(os.Stderr, "Usage: %s cert_file private_rsa_key_file\n", os.Args[0])
os.Exit(2)
}
... |
13f4be3d693866f4dac690c9e61c46b18b5a88c7 | d50cb39dca59e0fe869161ea032593d3cb85e05a | giner/ruby-buildpack | /vendor/github.com/cloudfoundry/libbuildpack/cutlass/cf.go | Go | go | 11,969 | permissive | package cutlass
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"math/rand"
"net/http"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"github.com/blang/semver"
"github.com/tidwall/gjson"
)
var DefaultMemory string = ""
var DefaultDisk string = ""
var Cached bool = false
var DefaultStdoutStderr io.Wr... |
83af6e81944a93d4742756054fb1636b11595302 | afb06915704b12812f627bc408ff034b2e4b6f7c | wu8685/kubebuilder | /testdata/project-v4-multigroup/controllers/ship/cruiser_controller.go | Go | go | 2,222 | 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, ... |
6346a5fa0f7cc2b42eff49e38fb613bf99d88f5a | d616f2e38ffb5987578c9c0985234afc572418b7 | beatlabs/patron | /vendor/github.com/elastic/go-elasticsearch/v8/typedapi/types/indicesindexingpressurememory.go | Go | go | 1,791 | permissive | // Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
460aa5bf67d3ca89fc748cb3aedc6b2f20f9520d | 92d5de095ea6aebb0247560d028afee69e59df4b | owainlewis/oci-cloud-controller-manager | /pkg/cloudprovider/providers/oci/load_balancer_security_lists.go | Go | go | 26,059 | permissive | // Copyright 2017 Oracle and/or its affiliates. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... |
5fcd34af8565750aa2cd3cc021c73c1e8968c79a | 3d08666c2b0aa4dfa8a0d642bc37be68f067933e | cpacia/openbazaar-go | /vendor/gx/ipfs/QmUuCcuet4eneEzto6PxvoC1MrHcxszy7MALrWSKH9inLy/go-maddr-filter/filter.go | Go | go | 1,226 | permissive | package filter
import (
"net"
"sync"
ma "gx/ipfs/QmSWLfmj5frN9xVLMMN846dMDriy5wN5jeghUm7aTW3DAG/go-multiaddr"
manet "gx/ipfs/QmVCNGTyD4EkvNYaAp253uMQ9Rjsjy2oGMvcdJJUoVRfja/go-multiaddr-net"
)
type Filters struct {
mu sync.RWMutex
filters map[string]*net.IPNet
}
func NewFilters() *Filters {
return &Filte... |
9fb9babeda2d31f8c959789dbfaac71551ed68d2 | f1faa786ef566d0d877bf078ac6b9c21a24c2033 | venugopal1234567/Protobuff | /grpc-course/blog/createTable/main.go | Go | go | 3,075 | no_license | // snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]
// snippet-sourceauthor:[Doug-AWS]
// snippet-sourcedescription:[DynamoDBCreateTable.go create an Amazon DynamoDB table.]
// snippet-keyword:[Amazon DynamoDB]
// snippet-keyword:[CreateTable function]
// snippet-keyword:[Go]
// sn... |
cd7f6d1416eed8fe680b17ef7a75f33d6df13671 | 1d9aa59741caf7aa663cde5fc7fbff376bcded44 | rotblauer/tsne4go | /utils.go | Go | go | 4,422 | permissive | package tsne4go
// Utility functions for tSNE
import (
"fmt"
"log"
"math"
"math/rand"
"os"
"runtime"
)
// return 0 mean unit standard deviation random number
func gaussRandom() float64 {
u := 2*rand.Float64() - 1
v := 2*rand.Float64() - 1
r := u*u + v*v
for r == 0 || r > 1 {
u = 2*rand.Float64() - 1
v ... |
1bf871700eef21081836c06d8e2aaea28c598249 | 7ec1a6ce8ab7d9fcc83f7a6ab1fb109bddcd40de | goodhosts/cli | /cmd/backup.go | Go | go | 800 | permissive | package cmd
import (
"path/filepath"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)
func Backup() *cli.Command {
return &cli.Command{
Name: "backup",
Usage: "Backup hosts file",
Action: backup,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "output",
Aliases: []string{"o"},
Usa... |
dfcfd88f6b243dbb53ef18dc64a938628f680080 | 7640ce376fe8796de14c991f9eaa78da41f2cfdc | grevian/graphviz-renderer-web | /cmd/goldfile.go | Go | go | 791 | permissive | // +build goldfile
package main
import (
"os"
"github.com/goccy/go-graphviz"
"github.com/sirupsen/logrus"
)
const testGraph = `
graph {
a -- b;
b -- c;
a -- c;
d -- c;
e -- c;
e -- a;
}
`
// Generate a goldfile for use in tests
func main() {
renderer := graphviz.New()
graph, err := gra... |
6d7e0bb10cbe903df4fc1a1503979874f912cd69 | b76c9bddba23d119b30705f35ac61befaeb50658 | webner/leo-operator | /pkg/apis/operator/v1alpha1/leocertificate_types.go | Go | go | 1,747 | no_license | package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// LeoCertificateSpec defines the desired state of LeoCertificate
// +k8s:openapi-gen=true
type LeoCertificateSpec struct {
// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
// Add custom validation u... |
cbcaaf3830aee07bd5e62352717560596332f29d | acf68a651f756ea6a5133d6d7deef73aa13f6b31 | digitalocean/kubernetes | /pkg/scheduler/factory.go | Go | go | 20,063 | 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, ... |
17282366f177fbf6dfb9cdc1be27630dce5176d2 | 80645d6b41aa079be5c9741647d414495d935d0e | mb-14/govaluate | /stagePlanner.go | Go | go | 18,040 | permissive | package govaluate
import (
"errors"
"fmt"
"time"
)
var stageSymbolMap = map[OperatorSymbol]evaluationOperator{
EQ: equalStage,
NEQ: notEqualStage,
GT: gtStage,
LT: ltStage,
GTE: gteStage,
LTE: lteStage,
REQ: regexStage,
NREQ: ... |
a9c40f133f994267bb7e86795c3d8839f3e776ed | 0710e493e11e49c84504879759dfe6b82981294b | morrell/pulumi-azure-native | /sdk/go/azure/network/v20200401/routeFilter.go | Go | go | 10,009 | 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 v20200401
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Route Filter Resource.
type RouteFilt... |
bdc290c642aaf5a3cd6e53b02dbf450b9ce2f8a0 | bf29cae037d5a6a95f4721327465024b78aa8aba | kangkot/pilosa | /fragment.go | Go | go | 37,498 | permissive | // Copyright 2017 Pilosa Corp.
//
// 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... |
3f366a5723418bad1cbe35262d63fa6f89b7d1b2 | 46eed6bc8c286298f2719df89100c3b0246d510c | cloudfoundry/diego-ssh | /scp/session.go | Go | go | 2,154 | permissive | package scp
import (
"bufio"
"errors"
"fmt"
"io"
"strings"
"code.cloudfoundry.org/lager/v3"
)
const (
NEWLINE = "\n"
SPACE = " "
)
type Session struct {
stdin *bufio.Reader
stdout io.Writer
stderr io.Writer
preserveTimesAndMode bool
logger lager.Logger
}
func NewSession(stdin io.Reader, stdout io... |
5707bd88a64de6d28eb120ec91c77c19b42b7c3c | 75168a25e4d36d39af26180f0c957b3c30095380 | jportasa/nri-postgresql | /src/metrics/instance_definitions.go | Go | go | 3,156 | permissive | package metrics
import (
"github.com/blang/semver"
)
func generateInstanceDefinitions(version *semver.Version) []*QueryDefinition {
queryDefinitions := make([]*QueryDefinition, 1, 3)
v91 := semver.MustParse("9.1.0")
v92 := semver.MustParse("9.2.0")
queryDefinitions[0] = instanceDefinitionBase
if version.GE(v9... |
e308c408d7f3e53bda45a4e622af9b939af885e9 | fe9076c24ff01db4fef4aaec642fca0f25fdce5a | shyamz-22/skipper | /dataclients/kubernetes/kube_test.go | Go | go | 88,755 | permissive | package kubernetes
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/json"
"encoding/pem"
"fmt"
"io"
"math/big"
mrand "math/rand"
"net"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"reflect"
"regexp"
"sort"
"syscall"
"testing"
"testing/quick"
"time"
... |
9bfae6d17bb41cc1917092ca3acd44b044c31241 | 915557d3d404e2a63fd995b7409da4357e034101 | embeddedgo/stm32 | /p/scb/scb_actrl/stm32g471xx.go | Go | go | 690 | permissive | // DO NOT EDIT THIS FILE. GENERATED BY svdxgen.
//go:build stm32g471xx
// Package scb_actrl provides access to the registers of the SCB_ACTRL peripheral.
//
// Instances:
// SCB_ACTRL SCB_ACTRL_BASE - - System control block ACTLR
// Registers:
// 0x000 32 ACTRL Auxiliary control register
// Import:
// github... |
72b7f818b04f850ed6857a8dbcb2e11b815c45db | 7a5b825b87cd37e34ac203b20055f24ca8941da6 | hugcoday/sentel | /commands/sentel-ceilometer/main.go | Go | go | 858 | permissive | // Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// dist... |
3bac65f5f3b6124cdedf1be1296a382ee4f917fe | 6e687d39428082037aeb44ed064ca9c47ad55a35 | uluyol/rgo | /dataframe/dtype_test.go | Go | go | 645 | permissive | package dataframe
import "testing"
type simpleComposite struct {
a int
b bool
}
func TestIsNumeric(t *testing.T) {
good := []SimpleData{
int(0),
int8(1),
int32(0xff),
int64(-44),
uint(99),
uint8(255),
uint16(11),
uint32(8245),
uint64(1231231299),
uintptr(123),
float32(0.523),
float64(-1123... |
b2c67c57a55c196398971f462507fb306a53efb4 | 7431725b9b6919d5a24b6539f4f200b018e49fd6 | volcano-sh-bot/volcano | /test/e2e/mpi.go | Go | go | 1,953 | permissive | /*
Copyright 2019 The Volcano 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, sof... |
bf8d10d232c192c3a1ce22b8fe1dca555efacbea | 726815f9712d133cbbc7d0802fdcb98f6c844b51 | faizan-firekamp/storage-node | /services/stripe_test_utils.go | Go | go | 364 | no_license | package services
import "github.com/opacity/storage-node/utils"
var testTokens = []string{
`tok_visa`,
`tok_visa_debit`,
`tok_mastercard`,
`tok_mastercard_debit`,
`tok_mastercard_prepaid`,
`tok_amex`,
`tok_discover`,
`tok_diners`,
`tok_jcb`,
`tok_unionpay`,
}
func RandTestStripeToken() string {
return tes... |
ad32063d074334fa7ef5083c5175aa92cd06669f | fc8daad4b55fadc0686ddb64e3558ffae313cea0 | cychust/jvm-go | /ch06/classfile/cp_utf8.go | Go | go | 2,127 | no_license | package classfile
import (
"fmt"
"unicode/utf16"
)
/*
CONSTANT_Utf8_info{
u1 tag
u2 length
u3 bytes //utf-8缩略编码
}
*/
type ConstantUtf8Info struct {
str string
}
func (self *ConstantUtf8Info) readInfo(reader *ClassReader) {
length := uint32(reader.readUint16())
bytes := reader.readBytes(length)
self.str ... |
b40d78888db7afb626fef529114fe7d5fd080356 | c1ee11786157fb744776b991df32d5b404d98a56 | yext/vitess | /go/vt/topo/topotests/srv_keyspace_test.go | Go | go | 32,083 | permissive | /*
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... |
fe6c4e7c054cad965ae4099baaa04b8dcdd189ff | 5447b3daa76b2087ad02ceb38f2f27a675bb7aec | Azwartin/tcp_chat_golang | /server/models/room.go | Go | go | 7,443 | no_license | package models
import (
"bytes"
"errors"
"fmt"
"net"
"strconv"
"strings"
"sync/atomic"
"time"
)
//Room Модель чат комнаты
type Room struct {
//Канал обмена сообщениями
MessageChannel chan []byte
//Текущее количество пользователей
UsersCount int64
//Максимальное количество пользователей в чате
UsersLimit... |
9c8897d22b67a78d3f2dcb71cf62ba54597fc645 | cb74211feedaf7c3e204fd31417654e193a1960e | vanackere/slim | /web/regexp_pattern.go | Go | go | 3,700 | permissive | package web
import (
"bytes"
"fmt"
"log"
"net/http"
"regexp"
"regexp/syntax"
"code.google.com/p/go.net/context"
)
type regexpPattern struct {
re *regexp.Regexp
prefix string
names []string
}
func (p regexpPattern) Prefix() string {
return p.prefix
}
func (p regexpPattern) Match(r *http.Request, c co... |
db6870ced5549558f282685a51b96e49608342fa | fd7f2d042b46fd9f8b4381b5baa991c2c508e86a | fedocx/tcloud_exporter | /metrics/redis.go | Go | go | 857 | permissive | // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed unde... |
edcf8eaba1da98c5f0eddfabfda3c11e7b12d8b4 | 6a4b03f4cca480007ca56179274c13b20732a234 | Gooooodman/src | /base/switch_input.go | Go | go | 1,028 | no_license | package main
import (
"bufio"
"fmt"
"os"
)
func main() {
inputReader := bufio.NewReader(os.Stdin) //生成一个读取器
fmt.Println("Please enter your name:")
input, err := inputReader.ReadString('\n')
if err != nil {
fmt.Println("There were errors reading, exiting program.")
return
}
fmt.Printf("Your name is %s",... |
5f48934b4b9a192459604d33c55275bab7c67ea9 | 9e1d3efb6e6d9bfdca41d16962cd3ccae4c55e36 | CadeLaRen/notary | /tuf/builder.go | Go | go | 23,075 | permissive | package tuf
import (
"fmt"
"github.com/docker/go/canonical/json"
"github.com/docker/notary"
"github.com/docker/notary/trustpinning"
"github.com/docker/notary/tuf/data"
"github.com/docker/notary/tuf/signed"
"github.com/docker/notary/tuf/utils"
)
// ErrBuildDone is returned when any functions are called on Rep... |
c7e1e718a641aa0f6b10fff1ff08a4f568e432ee | 7b500e3de2a4450140d7abefd14e00e1b473f6ea | w14525555/tabtoy | /v3/model/index.go | Go | go | 675 | permissive | package model
/*
添加字段和枚举, 需要在model.InitBuiltinTypes函数中添加入口
*/
type TableKind int32
const (
TableKind_None TableKind = iota //
TableKind_Type // 类型表
TableKind_Data // 数据表
TableKind_KeyValue // 键值表
)
type IndexDefine struct {
Kind TableKind... |
6bbc20591822a71fe36d2c7ffb6d21ed5ec8759d | 2045f28d53f4a83a34700dbb7e5d1b9690417553 | hamidrezabstn/go-dpi | /types/protocols.go | Go | go | 10,437 | permissive | package types
// Protocol is the type of each of the detected protocols.
type Protocol string
// Protocol identifiers for the supported protocols
const (
//SIZE Protocol = "SIZE"
UNKNOWN Protocol = ""
Unknown Protocol = UNKNOWN
FTP_CONTROL Protocol = "FTP_CONTROL" /* Tomasz Bujlow <tomasz@skatnet.dk> *... |
749165f1f5ee3aad874d69ef3039aadd98f18b32 | 3bf0ed47a7b46d80f97ee52abec653b2b807fe2d | 8260853/interface | /account.go | Go | go | 5,304 | permissive | package ys7
import "encoding/json"
//接口地址
const (
//[子账号]子账号接口
ACCOUNTCREATE = "https://open.ys7.com/api/lapp/ram/account/create" //创建子账户
ACCOUNTGET = "https://open.ys7.com/api/lapp/ram/account/get" //获取指定子账户信息
ACCOUNTLIST = "https://open.ys7.com/api/lapp/ram/accoun... |
deadedcf8089ec52128281e81f6dd00b8bb86a05 | e70f3d59e3a0ef01f8c09a7788ae8cb17a98e54f | liliangc/cilium | /pkg/health/client/client.go | Go | go | 7,404 | permissive | // Copyright 2017 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 ... |
3f3f8e124f648df3ae80ef9749a64683c54e010f | d33307396a7a2cfeec9e84f66539506e7eca5f11 | chifu1234/kusible | /pkg/loader/s3_test.go | Go | go | 7,724 | permissive | /*
Copyright © 2019 Michael Gruener
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, softwa... |
4b27466feb127a42513ecfc8be17ef585d818ed8 | 4f223c443137a644e5089f1ce2e8264732d21ad1 | mathianasj/cert-manager | /pkg/controller/ingress-shim/sync.go | Go | go | 11,847 | permissive | /*
Copyright 2019 The Jetstack cert-manager contributors.
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... |
ff3a2deeb9df971f062d451100043277bc9b137d | a0a5f831a10f47ae4ebb412456320f1b00f261df | GoogleCloudPlatform/k8s-config-connector | /third_party/github.com/hashicorp/terraform-provider-google-beta/google-beta/services/runtimeconfig/resource_runtimeconfig_config.go | Go | go | 6,312 | permissive | // Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package runtimeconfig
import (
"fmt"
"regexp"
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
"github.com/hashicorp/terrafor... |
3f446427500eaf0727aec1036e62ea31a9dd7e1c | 153de2fcc929b541e923752d48e37677a8e785a9 | emuhedo/iv | /cmd/iv/iv/register.go | Go | go | 1,792 | no_license | // Package iv is an APL extension that sends subarrays over a channel
//
// Iv is used by the command line program cmd/iv, but can also be registered
// in any APL instance by calling
// Register(a *Apl).
package iv
import (
"bufio"
"fmt"
"io"
"github.com/ktye/iv/apl"
"github.com/ktye/iv/apl/domain"
)
// Regist... |
eef79c6fd573178922f84f8d3c18cefaf1b1191e | ca482e132aea4881e832bab69df5b2179204bd9d | v13s/fabric-smart-client | /integration/fabric/atsa/fsc/atsa_suite_test.go | Go | go | 483 | permissive | /*
Copyright IBM Corp All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package fsc_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/hyperledger-labs/fabric-smart-client/integration"
)
func TestEndToEnd(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, ... |
ad3ecb0bb80ed2d85479062bf9a223e9c99834e1 | 47b74ccce5aeb8ef1322cbdb239bbd3565a5dd18 | edbrown23/SubtleLion | /src/webserver/router_test.go | Go | go | 889 | permissive | package webserver
import (
"net/http"
"testing"
)
func TestRouteValidRequest(t *testing.T) {
ro := newrouter()
ro.registerCallback("^/test/([\\w]+)$", routerTestFunc)
hr, _ := http.NewRequest("GET", "http://localhost:8000/test/waffle", nil)
res := ro.routeRequest(hr)
if res.Body != "w... |
2e9135142db0e1d6c282184e5c40e305b8da3fb5 | 6042511fa52f533a5b98927064de64d185421ace | TheRundown/goquery | /example_test.go | Go | go | 2,434 | permissive | package goquery_test
import (
"fmt"
"log"
"net/http"
"os"
"strings"
"github.com/TheRundown/goquery"
)
// This example scrapes the reviews shown on the home page of metalsucks.net.
func Example() {
// Request the HTML page.
res, err := http.Get("http://metalsucks.net")
if err != nil {
log.Fatal(err)
}
de... |
6bd990c6df994121ee0cb2da1659f6c8e18f1410 | e6465dbf04494bc4c5dd602fe0fbbeee65b1e182 | hansrodtang/pull | /handlers/deny/deny.go | Go | go | 498 | permissive | package deny
import (
"github.com/google/go-github/github"
"github.com/hansrodtang/pull"
)
func New(message string) pull.Middleware {
return func(client *github.Client, event *github.PullRequest) {
user, repo, number := pull.Data(event)
config := &github.IssueRequest{
State: github.String("closed"),
}
... |
c0118ca7cc5cf71e02e4234176e183f48443447a | 73601788f4d9012ba5ccbd3134c8e3c24621428d | caryyu/kubernetes-vault-client | /vendor/github.com/hashicorp/vault/vault/acl.go | Go | go | 10,707 | permissive | package vault
import (
"reflect"
"strings"
"github.com/armon/go-radix"
"github.com/hashicorp/errwrap"
"github.com/hashicorp/vault/helper/strutil"
"github.com/hashicorp/vault/logical"
)
// ACL is used to wrap a set of policies to provide
// an efficient interface for access control.
type ACL struct {
// exactR... |
1473232f93c20889c6c3a3efe14b051288841c8d | c8b7d7fe9d453863ecb543e9dcae5293984f14a4 | fooofei/leetcode | /cn-268-missing-number/go/code.go | Go | go | 519 | no_license | package leetcode
// 268 https://leetcode-cn.com/problems/missing-number/
// 0 1 2 3 (4)
// 0 1 2 3 4 (5)
func missingNumber1(nums []int) int {
var expectSum uint64
midLen := (len(nums) + 1) / 2
expectSum = uint64(len(nums)) * uint64(midLen)
if len(nums)%2 == 0 {
expectSum += uint64(midLen)
}
for _, n := ran... |
9eeae8ea59bd0eb9ad999d89d6a46203a83ab1ee | a556ca16c3f50c1a21aa1a2c4b94a78e6e6b6a38 | bin16/gamebox | /reversi/method_test.go | Go | go | 2,901 | no_license | package reversi
import (
"fmt"
"testing"
)
func (g *Game) print() {
last := g.History[len(g.History)-1]
cn := g.nextSide()
s := ""
for y := 0; y < 8; y++ {
r := fmt.Sprintf("|%d|", y+1)
for x := 0; x < 8; x++ {
c := g.Board[x][y]
if last[1] == x && last[2] == y {
r += pieceHistoryFace(c)
} else... |
98db9e69b12f217631ace8b782d452e11eb07a3b | c06b7eda2052a68fbfcfc42aec9bca407912f0ef | jack17529/MonitoringMuxRestfulAPI | /handlers/delete.go | Go | go | 989 | permissive | package handlers
import (
"monitoring/data"
"net/http"
"strconv"
"github.com/gorilla/mux"
)
// swagger:route DELETE /api/books/{id} books deleteBook
// Returns a list of books
// responses:
// 201: noContentResponse
// DeleteBook deletes a single book with a given id.
func (b *Books) DeleteBook(w http.ResponseW... |
d27b49367391ee0f4fb96f4ea19799aae287dd67 | 9164562b40699b6d889de6e3820a54a7222d933c | bpmcdevitt/terraform-provider-libvirt | /vendor/github.com/mitchellh/packer/vendor/github.com/oracle/oci-go-sdk/common/common.go | Go | go | 827 | permissive | // Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
package common
import (
"strings"
)
//Region type for regions
type Region string
const (
//RegionSEA region SEA
RegionSEA Region = "sea"
//RegionPHX region PHX
RegionPHX Region = "us-phoenix-1"
//RegionIAD region IAD
RegionIAD Re... |
5f0c90ecf76906d58114b8d59b4d3ac60f8766cd | aba8b9ae054ee04049735697c872e0608558deac | lvjing2/serving | /pkg/apis/serving/v1beta1/revision_defaults_test.go | Go | go | 3,980 | permissive | /*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
d290af375dc1fce0d048775d1afdbbb5a1092b92 | c3f63234868867e7e917a96f4cb0f33d1c182b14 | codezeros-dev/lnd | /channeldb/db.go | Go | go | 35,724 | permissive | package channeldb
import (
"bytes"
"encoding/binary"
"fmt"
"net"
"os"
"path/filepath"
"time"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/wire"
"github.com/coreos/bbolt"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/channeldb/migration12"
"github.com/lightningnetwork/lnd/ch... |
281884505d249f392f9a1071a32fbb03bf61ba28 | 7228c04fb94c6ca5e1564d18ad4cf5bc01df6fb1 | a-mac-user/golang-serialization-benchmark | /src/model/base.go | Go | go | 237 | no_license | package model
import "time"
type Base struct {
ID uint8 `gorm:"primary_key" json:"id"`
CreationTime time.Time `json:"creation_time"`
ModifiedTime time.Time `json:"modified_time"`
Ext string `json:"ext"`
}
|
431e7ca530a41e9467242fbd34ccdf31197d3382 | 4d4c61caff4c073d773a5fa8acfa95a0daf2dcb1 | emiyalee/micro-stream | /cmd/registrator/service/service.go | Go | go | 1,892 | no_license | package service
import (
"net"
"time"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
"github.com/emiyalee/micro-stream/pkg/consul"
)
//ConsulConfig ...
type ConsulConfig struct {
Address string //ConsulAddress eg "127.... |
031ea5d3d33670e41b0e5ad9363cc47fc223d768 | 59353f38920ba9e9867ca84152d6ea9c356b02ac | fzerorubigd/engine | /pkg/resources/list_test.go | Go | go | 292 | permissive | package resources
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestResource(t *testing.T) {
RegisterResource("a", "b")
s, ok := QueryResource("a")
assert.True(t, ok)
assert.Equal(t, s, "b")
s, ok = QueryResource("aa")
assert.False(t, ok)
assert.Empty(t, s)
}
|
1cb734cc6b998b5edcfb1055baa83fa73126ddab | bf97f3a375c9009964c564ed1c7602d8d9bcf485 | open-policy-agent/kube-mgmt | /pkg/opa/opa.go | Go | go | 4,970 | permissive | // Copyright 2017 The OPA Authors. All rights reserved.
// Use of this source code is governed by an Apache2
// license that can be found in the LICENSE file.
package opa
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
)
// Error contains the standard error fields returned by OPA.
type Error ... |
9c05a5328a454b35a6a163a88b7a0d724cc2cf58 | a7e599ba76b98799c2aea75b5caf5c463e2f6d30 | ZhaoDiankui/PolarDB-ClusterManager | /pkg/action/topology_change_action.go | Go | go | 1,564 | permissive | package action
import (
"fmt"
"github.com/ngaut/log"
"gitlab.alibaba-inc.com/RDS_PG/polardb_cluster_manager/pkg/common"
"gitlab.alibaba-inc.com/RDS_PG/polardb_cluster_manager/pkg/meta"
"gitlab.alibaba-inc.com/RDS_PG/polardb_cluster_manager/pkg/notify"
"gitlab.alibaba-inc.com/RDS_PG/polardb_cluster_manager/pkg/pl... |
80e06b98ab01a42c7b3f266cae7424e4113811c3 | 44bebc77813348be1262bcae004fb438b8c75c01 | sourya-deepsource/vald | /pkg/gateway/vald/service/meta_option.go | Go | go | 1,796 | permissive | //
// Copyright (C) 2019-2021 vdaas.org vald team <vald@vdaas.org>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless requir... |
37083995a8de6f410f2eafbb6fa9d0554c1c6df5 | d59199eb50c965b47a0cebeca233eecabea9ac16 | sttts/kubernetes | /pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion/generated_expansion.go | Go | go | 796 | permissive | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
ad028f9111b3fd56ad069ee93ac1b0331fc52860 | 71ec838a7a7d66f954dc6cac38631a7446f64090 | mfkiwl/icemulti | /cli/cmd/serve.go | Go | go | 1,256 | no_license | // Copyright © 2018 1138-4EB <@github>
//
// Unless required by applicable law or agreed to in writing, this
// software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied.
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
// serveCmd represents the ... |
543075c25a5748dfdbf28becb3dabf63e253edde | b7c5a39665d2e4f753c605a4c59eee06239faf3e | paulantezana/facturacion-go | /queries/producto.go | Go | go | 633 | no_license | package queries
import (
"github.com/graphql-go/graphql"
"github.com/paulantezana/facturacion-go/models"
"github.com/paulantezana/facturacion-go/config"
)
func ProdutoQuery() *graphql.Field {
return &graphql.Field{
Type: graphql.NewList(models.ProductoType),
Resolve: func(p graphql.Res... |
c5db2d30fc4b47ed983771b33a1a56cbe34ffa8d | e86839f1bd9da8c52654315aaa23c62e7cefb210 | tonyking97/inventory-stockmanagement | /utils/roundoff.go | Go | go | 284 | no_license | package utils
import "math"
func round(num float32) int {
return int(float64(num) + math.Copysign(0.5, float64(num)))
}
func RoundOff(num float32, precision int) float32 {
output := math.Pow(10, float64(precision))
return float32(round(num*float32(output))) / float32(output)
}
|
50061a8211a6cfe22eeb59b0986d10d123bd282e | 4089258cea43c504abc8b5d1d1f89107ffdec66d | cnt0/twitch-streamsniper | /player-connection/mpv/mpv.go | Go | go | 408 | permissive | package mpv
import blang "github.com/blang/mpv"
// Connection ...
type Connection struct {
mpvClient *blang.Client
}
// NewConnection ...
func NewConnection(socket string) *Connection {
return &Connection{
mpvClient: blang.NewClient(blang.NewIPCClient(socket)),
}
}
// PlayVideo ...
func (c *Connection) PlayVid... |
0da991fa0f571f5cad147cce989bf3f9fc5e618b | 13aa722abcc0fcb57dd76db3e5c32c0e9924bf27 | richhx/core | /x/ref/runtime/internal/testing/concurrency/mutex_test.go | Go | go | 5,090 | permissive | // Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// concurrency_test is a simple test of the framework for systematic
// testing of concurrency.
package concurrency_test
import (
"fmt"
"io/ioutil"
"o... |
c24c6f2c5dad3bde45c0f1f397a050cb0f66b34d | e9c7ac445f37c49bc2d0e8c17780b4a2cfdb1d61 | makarimachmad/makarimappstore | /service/auth.service.go | Go | go | 1,026 | no_license | package service
import (
"errors"
"log"
"github.com/makarimachmad/makarimappstore/repo"
"golang.org/x/crypto/bcrypt"
)
type AuthService interface {
VerifyCredential(email string, password string) error
// CreateUser(user dto.) entity.User
}
type authService struct {
userRepo repo.UserRepository
}
func NewAu... |
f8287aef5d2ce65a8d4c6f191ae824785f3e593e | 6529867bdc767923e3e4520afd8349fa43789191 | paulvollmer/ansible_puller | /venv.go | Go | go | 4,025 | permissive | // Functions and types for interacting with virtual environments
package main
import (
"bufio"
"bytes"
"context"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
var (
venvCommandTimeout = 2 * time.Hour // 2 hours timeout
)
// VenvConfig... |
b9ee7592b8d9bcb4ca56c047171f7a2b6babf3a1 | f63900bba47c3c23e3f20371828fc6d3024131c1 | dongfengyuli/my-leetcode | /chapter06/79.go | Go | go | 1,143 | no_license | package main
import "fmt"
func main() {
bord := [][]byte{
{'A','B','C','E'},
{'S','F','C','S'},
{'A','D','E','E'},
}
word := "ABCCED"
res := exist(bord,word)
fmt.Println(res)
}
func exist(board [][]byte, word string) bool {
m := len(board)
if m == 0 {
return false
}
n := len(board[0])
if n == 0 {... |
9d82fd51a3cc7d9514e7e5a1b70a65e4541bd626 | 6ac43c2abec8073cfe285e03b940e1edf9758151 | datauduong/mbt | /lib/intersection.go | Go | go | 2,607 | permissive | package lib
import git "github.com/libgit2/git2go"
// IntersectionByCommit returns the manifest of intersection of modules modified
// between two commits.
// If we consider M as the merge base of first and second commits,
// intersection contains the modules that have been changed
// between M and first and M and se... |
909fde0f2507f53fdeb9c05d3f151149d77ea668 | 01a2bd2626029c8860c94d57ffc05af63c069191 | Solertis/prometheus | /retrieval/target.go | Go | go | 10,796 | permissive | // Copyright 2013 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 agreed to... |
28c8cf513a65205763000161c9d76d01f648a759 | fbd9e42065ed5ef2cbc7fb81ee1bb1ed9d55db75 | atomix/atomix | /runtime/pkg/runtime/v1/driver.go | Go | go | 932 | permissive | // SPDX-FileCopyrightText: 2022-present Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
package v1
import (
"context"
"github.com/atomix/atomix/api/errors"
runtimev1 "github.com/atomix/atomix/api/runtime/v1"
"github.com/atomix/atomix/runtime/pkg/driver"
)
type DriverProvider interface {
LoadDriver(c... |
0167c619644ec5ec19741da1c1015f395a2ee78a | 51cb77ca312a78f226140913859d7038385ab0a3 | kubesphere/kubesphere | /vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/variables_are_input_types.go | Go | go | 751 | permissive | package validator
import (
"github.com/open-policy-agent/opa/internal/gqlparser/ast"
//nolint:revive // Validator rules each use dot imports for convenience.
. "github.com/open-policy-agent/opa/internal/gqlparser/validator"
)
func init() {
AddRule("VariablesAreInputTypes", func(observers *Events, addError AddErr... |
9279934d18e8fd6f5621aad1ccbc8ec13fa05ede | 96a0c3368a23ee5bc03f2c6e1112ac1d0985d99a | raysonxin/go-iot | /dragon/drivers/modbus/modbus-tcp.go | Go | go | 2,130 | no_license | // this is a wrapped driver for modbus tcp device.
package modbus
import (
"fmt"
"log"
"os"
"strconv"
"time"
"github.com/goburrow/modbus"
"github.com/raysonxin/go-iot/dragon/drivers"
"github.com/raysonxin/go-iot/dragon/utils"
)
//ModbusTcpDriver modbus tcp driver
type ModbusTcpDriver struct {
drivers.Driver... |
d8176b635dedf9bd134af4722bb66f8b8e5e43f3 | c17af8784e60f8f5c9a688c1fe3f838fa5b879fd | frankfanslc/ciao | /ssntp/examples/server.go | Go | go | 3,338 | permissive | //
// Copyright (c) 2016 Intel Corporation
//
// 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... |
e41adc2204f1de98cf414bebc910346a38e75df5 | 49ba01be4d4f7941f344dd81cfbb3c4ed493979b | daisuzu/golang-tokyo-8 | /main.go | Go | go | 285 | no_license | type service struct{}
func (s *service) Create(ctx context.Context, in *pb.CreateRequest) (*pb.CreateResponse, error) {
return &pb.CreateResponse{}, nil
}
func main() {
s := grpc.NewServer()
pb.RegisterContractServer(s, &service{})
l, _ := net.Listen("tcp", ADDR)
s.Serve(l)
}
|
c766276732ca95a6e3eec2b27389a32726261060 | cbbe0eb03c29a698f4fed4481ec0049d361e92a3 | iamsubendu/Go-Basics | /5.go | Go | go | 796 | no_license | //if, else, switch
package main
import (
"fmt"
"time"
)
func main() {
num := 2
if num == 1 {
fmt.Println("one")
} else if num == 2 {
fmt.Println("two")
} else {
fmt.Println("none")
}
switch num {
case 1:
fmt.Println("one")
case 2:
fmt.Println("two")
default:
fmt.Print... |
5817722fd2ee1bbcc125d31b5cf078e9f53fcfde | 66b9679ae3bac4cee8ab852c9b7d2cd21cf526fa | Julian-Chu/Leetcode-golang | /leetcode/leetcode959/leetcode959.go | Go | go | 1,151 | no_license | package leetcode959
func regionsBySlashes(grid []string) int {
m := len(grid)
size := m * m * 4
u := newUnion(size)
for i := 0; i < m; i++ {
for j := 0; j < m; j++ {
baseIndex := (i*m + j) * 4
top := baseIndex + 0
right := baseIndex + 1
down := baseIndex + 2
left := baseIndex + 3
switch grid[i... |
44035d88775ac85e4fce66938d925aa6453e1c2e | 93aee8d9039a9e94792310a4e53588a43d146e47 | particuleio/charts | /istio/pilot/test/xdstest/test.go | Go | go | 1,695 | 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... |
101924d3c9099b200ece4b6305af435eeb8a2144 | 4d4c44738eeedcffcb819ade12b48958a717be5d | bourbaki-czz/classzz | /blockchain/process.go | Go | go | 7,590 | permissive | // Copyright (c) 2013-2017 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package blockchain
import (
"fmt"
"github.com/bourbaki-czz/classzz/chaincfg/chainhash"
"github.com/bourbaki-czz/classzz/database"
"github.com/bourbaki-czz/czzutil"... |
8cdbdfec098aab7f6ecc6cdc6b8771c78b7aa2db | adaa9c005aa12ef580834fdb6089950fbe15204b | SincereXIA/jcs | /service/httpserver/main.go | Go | go | 2,300 | permissive | package main
import (
"encoding/json"
"flag"
"io/ioutil"
"github.com/Sean-Pearce/jcs/service/httpserver/dao"
pb "github.com/Sean-Pearce/jcs/service/scheduler/proto"
"github.com/Sean-Pearce/jcs/service/storage/client"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
)
cons... |
f2c02f85ce0cef72f29051b6ca1dcd3a42f6d0a5 | 6b0eb12cf715f3de738a39412620e70eea9a76f0 | nickrisaro/generador-de-frases | /palabras/predictor_test.go | Go | go | 2,584 | no_license | package palabras_test
import (
"strings"
"testing"
"github.com/nickrisaro/generador-de-frases/palabras"
)
func TestGenerarFraseDeDosPalabras(t *testing.T) {
// Inicialización
libroDeFrases := palabras.NewLibroDeFrases()
libroDeFrases.AgregarFrase("¿cómo estás?")
selector := palabras.NewSelectorMaximaFrecuenc... |
16dba547b552d9cf81deb90bcc4910395d703cb6 | 814fe05a9cfc057d3cec276ae46d5d820bdc86aa | damianmcgrath/threagile | /risks/built-in/missing-build-infrastructure/missing-build-infrastructure-rule.go | Go | go | 4,391 | permissive | package missing_build_infrastructure
import (
"github.com/damianmcgrath/threagile/model"
)
func Category() model.RiskCategory {
return model.RiskCategory{
Id: "missing-build-infrastructure",
Title: "Missing Build Infrastructure",
Description: "The modeled architecture does not contain a build infrastructur... |
12875df00b4243893d7f34a757839c9c3513cb4c | ba7a40f6b515a9f8d0462f1cb1b8234c29937fab | benjaminchencobinhood/stellar | /services/horizon/internal/paths/main.go | Go | go | 714 | permissive | package paths
import (
"github.com/benjaminchencobinhood/stellar/xdr"
)
// Query is a query for paths
type Query struct {
DestinationAddress string
DestinationAsset xdr.Asset
DestinationAmount xdr.Int64
SourceAssets []xdr.Asset
}
// Path is the result returned by a path finder and is tied to the Destin... |
4a99f1bd6e202fda061e37c01c221147585df698 | e54b622b230f7275b7e50d034b9b25f34e3c1dd3 | alphatauri/gtd | /tasklist/tasks.go | Go | go | 1,016 | permissive | package tasklist
import (
"fmt"
"log"
"strconv"
"strings"
)
type Task struct {
name string
completed bool
}
func NewTask(name string) *Task {
task := new(Task)
task.name = strings.TrimSpace(name)
task.completed = false
return task
}
func LoadTask(storedString string) *Task {
task := new(Task)
parts... |
5eaf81a317f7b0cb311b944c010c71e0956dfc2d | 7ded21b73b87d8a4853b8ec1496caa5b96d794e7 | Melenium2/Goken | /ken/anon_func_signature.go | Go | go | 1,918 | no_license | package ken
import (
"github.com/Melenium2/goken/kenerrs"
"strings"
)
type AnonFuncSignature struct {
funcParams []*FuncParam
returnTyp []string
callers []string
}
func NewAnonFuncSignature() *AnonFuncSignature {
return &AnonFuncSignature{}
}
func (f *AnonFuncSignature) AddParams(params ...*FuncParam) *An... |
1285c06ac80a22e4546d3fe743c73c4bc7900b41 | abb47f62c016299e97eeefa29db5432eb9270679 | hey-kong/languordb | /sstable/block/iterator.go | Go | go | 1,442 | no_license | package block
import (
"github.com/hey-kong/languordb/internalkey"
)
type Iterator struct {
block *Block
index int
}
// Return true if the iterator is on a valid node
func (it *Iterator) Valid() bool {
return it.index >= 0 && it.index < len(it.block.items)
}
func (it *Iterator) InternalKey() *internalkey.Intern... |
9f3c403dbca647ef3c9803d3f7d4b5b8f4bcff0c | 6e8c4f21b02df126bd68721005e7736710bbc2ec | apache/beam | /playground/backend/internal/db/dto/snippet.go | Go | go | 1,056 | 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 not... |
60811de72585f118867722f6b8f36f7239b0db59 | 5ce39aae6b18790fc1654725f7b3a255b195a44f | kotamat/startingo | /pkg/template/main.go | Go | go | 624 | no_license | package main
import (
"html/template"
"os"
)
type Friend struct {
Fname string
}
type Person struct {
UserName string
Emails []string
Friends []*Friend
}
func main() {
f1 := Friend{Fname: "name1"}
f2 := Friend{Fname: "name2"}
t := template.New("fieldname example")
t, _ = t.Parse(`
hello {{.UserName... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.