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 |
|---|---|---|---|---|---|---|---|---|
1eadd88c785ee896bad1b96fd8111e3e8f33e8ab | a13d9396addc1d02784ff1e1462dd97d43637bdb | DataDog/opentelemetry-collector-contrib | /exporter/kafkaexporter/config_test.go | Go | go | 5,883 | permissive | // Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package kafkaexporter
import (
"fmt"
"path/filepath"
"testing"
"time"
"github.com/IBM/sarama"
"github.com/cenkalti/backoff/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collect... |
2345d2147141ccd0e5c784470619a8d22f779e6c | 2168e579e35266c7cdfecb2dc59816ec8611a7a3 | wahyueko22/golang-learning | /map/map.go | Go | go | 524 | no_license | package main
import "fmt"
func main() {
var chicken3 = map[string]int{}
var chicken4 = make(map[string]int)
//var chicken5 = *new(map[string]int)
chicken3["one"] = 1
chicken4["one"] = 1
//chicken5["one"] = 1
fmt.Println("result", chicken3["one"], chicken4["one"])
mapToAnotherFunction(chicken3)
for key, val :... |
242e28c10c4b068d8f9791820f4d36485ec95456 | b5103e73f34c51b508c005c820612c65b1722bda | sgtest/monorepo-test-3 | /kubernetes-5/pkg/volume/metrics_du.go | Go | go | 2,868 | 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, ... |
b6d2f8617b78f04e3e7fbfd81ade34b15ca2fab4 | bd8c4c7fb5498d21ecde6d5489759095398aa51f | smsufyian/eventing | /test/conformance/source_crd_rbac_test.go | Go | go | 915 | permissive | // +build e2e
// +build !project_admin
/*
Copyright 2021 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 appl... |
8f2f26df1e099a3fd1ce0dad8c2980140764e3f8 | 226151302263a0f4d28152717bd1110400a89bff | cloudflare/go | /src/cmd/cgo/internal/test/issue8517.go | Go | go | 286 | permissive | // Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !windows
package cgotest
import "testing"
func test8517(t *testing.T) {
t.Skip("skipping windows only test")
}
|
f153f6b2ce14b6d7f59ab3fb2429c5bcef07ca45 | ab5f412ce5d50b6845fdd38fa738775df9b52655 | Strangecycle/gin-vue-admin-l | /model/response/sys_authority.go | Go | go | 291 | no_license | package response
import "gin-vue-admin-l/model"
type SysAuthorityResponse struct {
Authority model.SysAuthority `json:"authority"`
}
type SysAuthorityCopyResponse struct {
Authority model.SysAuthority `json:"authority"`
OldAuthorityId string `json:"oldAuthorityId"`
}
|
691f31f636a8869ab410ac138c9040032b5b7740 | c4210ee1ac643033b4770af0769d3adaf8af8f43 | openshift/oc | /pkg/cli/config/kubeletbootstrapkubeconfig/new_kubelet_bootstrap_kubeconfig.go | Go | go | 4,801 | permissive | package kubeletbootstrapkubeconfig
import (
"context"
"fmt"
configv1client "github.com/openshift/client-go/config/clientset/versioned"
"github.com/openshift/oc/pkg/cli/config/refreshcabundle"
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8... |
5c4b3e29f194aa2ea7cc06b9b4ebf77464a00ea3 | e3c6db7b2465e3ec781fce3d02dc7792a8b1b64b | opentelekomcloud/gophertelekomcloud | /openstack/rts/v1/stacktemplates/testing/fixtures.go | Go | go | 1,993 | permissive | package testing
import (
"fmt"
"net/http"
"testing"
th "github.com/opentelekomcloud/gophertelekomcloud/testhelper"
fake "github.com/opentelekomcloud/gophertelekomcloud/testhelper/client"
)
// GetExpected represents the expected object from a Get request.
var GetExpected = "{\n \"description\": \"Simple templat... |
1d6ba2a1e265365f52bca80409a1c44e15a3b695 | 37e0c3173b27a1b95b0c4834d33cf52714590540 | rocket049/md-embed | /main.go | Go | go | 2,061 | no_license | package main
import (
"bufio"
"crypto/md5"
"encoding/base64"
"flag"
"fmt"
"io/ioutil"
"log"
"mime"
"os"
"path"
"path/filepath"
"regexp"
"strings"
)
func main() {
flag.Usage = func() {
fmt.Printf(`Usage of md-embed:
md-embed -o [Output filename] <Input filename>
-o string
Output file name (default ... |
b091d23f169edf9aa93166da216cf557502b0374 | 6728e66712630613a4cef075cac5ed1715206c65 | jorgelbg/grafana | /pkg/services/kmsproviders/defaultprovider/grafana_provider.go | Go | go | 847 | permissive | package defaultprovider
import (
"context"
"github.com/grafana/grafana/pkg/services/encryption"
"github.com/grafana/grafana/pkg/services/secrets"
"github.com/grafana/grafana/pkg/setting"
)
type grafanaProvider struct {
settings setting.Provider
encryption encryption.Internal
}
func New(settings setting.Prov... |
dfe1d8268e33981bb96681f28f98301493e9e289 | 1d903462e94312b0cb3d86778e2a5f5645e413c7 | XiaoBoya/pkg | /client/bearer_token.go | Go | go | 2,603 | permissive | /*
Copyright 2021 The Katanomi 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, so... |
657be21677db348567478c5f707d09282b17b219 | d6dec700192865053dc5793c8e7865bb7b0221ae | TheArchiver/banshee | /alerter/alerter.go | Go | go | 8,164 | permissive | // Copyright 2015 Eleme Inc. All rights reserved.
package alerter
import (
"encoding/json"
"errors"
"os/exec"
"sync"
"sync/atomic"
"time"
"github.com/eleme/banshee/config"
"github.com/eleme/banshee/health"
"github.com/eleme/banshee/models"
"github.com/eleme/banshee/storage"
"github.com/eleme/banshee/stora... |
7674e35f668f267d428af3f9e7218e3d929701f3 | 0686a7a2f916523ddc151cd35b752617d214819e | SmartLyu/Goland | /Patrol/PatrolServer/Mysql/ConnectDB.go | Go | go | 923 | no_license | package Mysql
import (
"../Global"
"database/sql"
_ "github.com/go-sql-driver/mysql"
"strings"
)
//数据库配置
const (
userName = "lyu"
password = "Patrol@123"
ip = "127.0.0.1"
port = "3306"
dbName = "patrol"
)
//Db数据库连接池
var DB *sql.DB
// 连接数据库
func InitDB() {
//构建连接:"用户名:密码@tcp(IP:端口)/数据库?charset=... |
11026a0f97984ff20c1b8a9325f68bfd34db2cdf | 95c6fb210dd838ff2122c2d1f15a2ab93facb6c6 | sgtest/monorepo-test-3 | /kubernetes-1/test/e2e/upgrades/persistent_volumes.go | Go | go | 3,958 | 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, ... |
cc2e3f7fe365d0c0e0fcb176d67d4fbdff74c603 | c89a3420f45303a3642c31c1b83b068cb4f458d9 | gorshenev/dcoin-go | /packages/controllers/new_holidays.go | Go | go | 817 | no_license | package controllers
import (
"github.com/democratic-coin/dcoin-go/packages/utils"
)
type newHolidaysPage struct {
SignData string
ShowSignData bool
TxType string
TxTypeId int64
TimeNow int64
UserId int64
Alert string
Lang map[string]string
CountSignArr []int
}
func (... |
c3989138184867254673c0782da7b1132d1e1f2e | ab06328ecdc047c1f05884c2e91395127d101f83 | vonwenm/gp-config | /suite_test.go | Go | go | 675 | permissive | package config_test
import (
"fmt"
. "launchpad.net/gocheck"
"testing"
)
func TestAll(t *testing.T) {
TestingT(t)
}
// EqualSlice checks whether two arrays are equal or not.
type equalSliceChecker struct {
*CheckerInfo
}
var EqualSlice = &equalSliceChecker{
&CheckerInfo{Name: "EqualSlice", Params: []string{"s... |
1d8ee1a247b015f0f593e2f7c6b99adedb65f76f | fa5b7191c66f2394bbd05a9f8fd187dd44508b1e | webbestmaster/golang-example | /part-2/1/main.go | Go | go | 385 | no_license | package main
import "fmt"
type Saiyan struct {
Name string
Power int
}
func main() {
goku := &Saiyan{"Goku", 9000}
Super(goku)
fmt.Println(goku.Power)
goku2 := NewSaiyan("Hocku", 2000)
Super(&goku2)
fmt.Println(goku2.Power)
}
func Super(s *Saiyan) {
s.Power += 10000
}
func NewSaiyan(name string, power i... |
ad44b46f167992c652a6ef064343bf503e35edc8 | 468804b89aa1cd60cd94df425047444a969299f6 | kanseiishikawa/golang_http | /send/request.go | Go | go | 1,535 | no_license | package main
import (
"net/http"
"io/ioutil"
"io"
"encoding/json"
"fmt"
"os"
"mime/multipart"
"bytes"
)
type json_data struct {
IP string `json:"IP"`
}
func main() {
var url = connect_url()
url += "/remote/sh_command"
sh, form_type, err := send_file_pre( "hello.sh" )
if err != nil {
fmt.Println( er... |
5491e41d2d4916608746bde2dfbff466015e9c41 | b7764b83b542d695057e00eb83e112103b98725c | bububa/opentaobao | /model/ma/TaobaoWirelessXcodeCreateAPIRequest.go | Go | go | 2,239 | permissive | package ma
import (
"net/url"
"github.com/bububa/opentaobao/model"
)
// TaobaoWirelessXcodeCreateAPIRequest 创建二维码/短连接 API请求
// taobao.wireless.xcode.create
//
// 创建码平台的普通二维码或者长连接转短连接服务
type TaobaoWirelessXcodeCreateAPIRequest struct {
model.Params
// 码平台开放的业务code
_bizCode string
// 原始内容/原始地址
_content string
... |
da9da12bfb21b5054654b3df55ba98424aba4b67 | f6c0387f6bbf95d03798682e8d7cce31c6de928f | johnnycrab/euler | /problem90.go | Go | go | 1,355 | no_license | /*
Problem 90
*/
package main
import (
"fmt"
"./crabMath"
)
var squares = [][]int{{0,1}, {0,4}, {0,9}, {1,6}, {2,5}, {3,6}, {4,9}, {6,4}, {8,1}}
func main() {
// keeping track of good pairs.
count := 0
// we first generate all 10 choose 6 sets
choiceSets := crabMath.NChooseKSets(10, 6)
for i := 0; i<len(c... |
dacaa97f06835b1b79f128bcc4f8175cdd5f7005 | bbf1da78b62c4193dfc84e567d6d9b415cdd581b | cwjjamk/gmcache | /gmcache/storagemgr.go | Go | go | 1,983 | permissive | package gmcache
import (
"hash/crc32"
"sync/atomic"
"time"
)
//The implementation of IStorage
type StorageManager struct {
bucketNum int
buckets []*Storage
memoryLimit int64
memeryUsed int64
cleanInterval time.Duration
memChangedChan chan int64
stop chan struct{}
}
//memoryLim... |
38d66fc9e1b5e8185f732eb4a43639a85c75349e | 31d87f3636e9a19038c570e141e86b8a309de7fc | dxx/leetcode-note | /code-go/insertposition/main.go | Go | go | 1,009 | no_license | package insertposition
// 搜索插入位置
// 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。
//
// 你可以假设数组中无重复元素。
// 示例
// 输入: [1,3,5,6], 5
// 输出: 2
// 输入: [1,3,5,6], 2
// 输出: 1
// 输入: [1,3,5,6], 7
// 输出: 4
// 输入: [1,3,5,6], 0
// 输出: 0
func searchInsert(nums []int, target int) int {
start, end := 0, len(n... |
aa3f772542d5826e3bd9423a2d999a165373854d | 224e7480c910a0f0ea601212f4f34f0e68d36d15 | lack/cluster-kube-controller-manager-operator | /vendor/github.com/openshift/library-go/pkg/operator/staticpod/controller/installerstate/installer_state_controller.go | Go | go | 7,339 | permissive | package installerstate
import (
"context"
"fmt"
"strings"
"time"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/informers"
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
operatorv1 "github.com/openshift/api/operator/v1"
"... |
9a4de05ad7ccb27a68a69443cd0b5a0e6b221a6e | 834038a5e35208f667f9718c772ff9020f29888e | veloc1/notification-processor | /bitbucketprocessor.go | Go | go | 1,951 | permissive | package main
import (
"encoding/json"
"errors"
"net/http"
"strings"
)
type BitbucketLink struct {
Href string
}
type BitbucketLinks struct {
Comments BitbucketLink
Html BitbucketLink
}
type BitbucketPR struct {
Links BitbucketLinks
}
type BitbucketRepo struct {
Name string
}
type BitbucketEvent struc... |
2a917f83ea5ff349dd9317310b8c219898a6f4b6 | 77a1d81d8595708649251ab2b477dca6c432088e | SaveTheRbtz/toolbox | /infra/recipe/rc_value/val_fdfile_rowfeed.go | Go | go | 3,184 | permissive | package rc_value
import (
"github.com/iancoleman/strcase"
"github.com/watermint/toolbox/essentials/file/es_filepath"
"github.com/watermint/toolbox/essentials/go/es_reflect"
"github.com/watermint/toolbox/essentials/log/esl"
"github.com/watermint/toolbox/infra/app"
"github.com/watermint/toolbox/infra/control/app_c... |
047e237f9db076635ef9f3bfada4a3f91a6a1e9d | c348e2a70766084b593d33a9ba478ad352f8efa0 | DIBYAJYOTINANDA/cli | /cf/commands/application/set_health_check_test.go | Go | go | 5,317 | permissive | package application_test
import (
"errors"
"github.com/cloudfoundry/cli/cf/api/applications/applicationsfakes"
"github.com/cloudfoundry/cli/cf/commandregistry"
"github.com/cloudfoundry/cli/cf/configuration/coreconfig"
"github.com/cloudfoundry/cli/cf/models"
"github.com/cloudfoundry/cli/cf/requirements"
"github... |
c1e75bbe3e6d1419cad8ba080571e636de65e60b | d06a6085379be7c51719971b330721763e716afd | dujigui/blog | /services/db/db.go | Go | go | 524 | no_license | package db
import (
"database/sql"
"errors"
. "github.com/dujigui/blog/utils"
_ "github.com/go-sql-driver/mysql"
"log"
"os"
)
var (
db *sql.DB
ErrIDNotExists = errors.New("无此 ID 数据")
)
func DB() *sql.DB {
return db
}
func init() {
var err error
dsn := os.Getenv("BLOG_DSN")
if dsn == "" {
l... |
ca5bb0befacbb657f80fb5fe9a198276fc71ff67 | 8516371af123112c04a96ef486445b2c4cdd3344 | lancefrench/splunk-firehose-nozzle | /testing/event_writer_mock.go | Go | go | 772 | permissive | package testing
import (
"errors"
"sync"
)
type EventWriterMock struct {
lock sync.Mutex
capturedEvents []map[string]interface{}
PostBatchFn func(events []map[string]interface{}) error
ReturnErr bool
}
func (m *EventWriterMock) Write(events []map[string]interface{}) error {
if m.ReturnErr {
... |
ccd7e89ceb5fe64bd7952b5a31feac7846849f9d | 331e62a51647c19acec9902c4c98fb99539705c5 | charlievieth/imports | /event/export/printer.go | Go | go | 1,028 | permissive | // Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package export
import (
"io"
"github.com/charlievieth/imports/event/core"
"github.com/charlievieth/imports/event/keys"
"github.com/charlievieth/imports/ev... |
550caa0245bcd4f6f312de63510a6a47fbd18cbf | be8a933a79078027569fb6290ffd37b55d12345b | felytic/go_web_server | /middlewares_test.go | Go | go | 885 | no_license | package main
import (
"./middlewares"
"fmt"
"net/http"
"testing"
)
func dummyHandler(writer http.ResponseWriter, request *http.Request) {
fmt.Fprintln(writer, "Plan not found")
}
type MyResponseWriter struct {
header http.Header
}
func (w *MyResponseWriter) Header() http.Header {
return w.header
}
func (w *... |
5828776c726419e94a80fe6b5d057d039c482f82 | e917fa03b6ca949ec1e82db75f05306bcd487cd3 | laudarch/iso20022 | /SecuritiesTransactionType25Choice.go | Go | go | 654 | permissive | package iso20022
// Choice of format for the settlement transaction type information.
type SecuritiesTransactionType25Choice struct {
// Securities transaction type expressed as an ISO 20022 code.
Code *SecuritiesTransactionType7Code `xml:"Cd"`
// Securities transaction type expressed as a proprietary code.
Prop... |
faff666d68a5d7fd1b3e68103bcd39b807eed79a | b662a20957cd41ee8541a2254e7269aed1e0aff5 | liggitt/kube-aggregator | /vendor/k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1/types.go | Go | go | 31,713 | 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, ... |
aff173c2bf7d8f1a327fc69da1bd312385d7a6e4 | 85bbbd4c7d79760879f7026523a313a9678a1e33 | arangodb/kube-arangodb | /pkg/apis/replication/v1/endpoint_authentication_spec.go | Go | go | 3,397 | permissive | //
// DISCLAIMER
//
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
//
// 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 re... |
ee62e4f56ebfa9516b9ef05b0a8670bc19626c57 | 366544e1a232dcd0302c1c511232026f35d6e39a | artembannikov/jenkins-library | /cmd/checkIfStepActive_test.go | Go | go | 1,841 | permissive | package cmd
import (
"io"
"io/ioutil"
"strings"
"testing"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
"github.com/stretchr/testify/assert"
)
func checkStepActiveOpenFileMock(name string, tokens map[string]string) (io.ReadCloser, error) {
var fileContent string
switch name {
case ".pipeline/defau... |
184e75508453833cca34639824a5a4b8090e619a | 6aaaea16d6b0eda42951c621c67ad55a422a8db9 | spotinst/spotinst-sdk-go | /examples/service/elastigroup/providers/aws/read/main.go | Go | go | 1,362 | permissive | package main
import (
"context"
"log"
"github.com/spotinst/spotinst-sdk-go/service/elastigroup"
"github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/aws"
"github.com/spotinst/spotinst-sdk-go/spotinst"
"github.com/spotinst/spotinst-sdk-go/spotinst/session"
"github.com/spotinst/spotinst-sdk-go/spot... |
c002712722a4d5b2cd3194d5112e054cc925668a | ecaf69cd76b291c7d301281228fcdac16f5bf49e | bruinxiong/fedlearner | /deploy/kubernetes_operator/pkg/operator/trainingset/training_set_pod.go | Go | go | 7,648 | permissive | package trainingset
import (
"context"
"fmt"
"strconv"
"strings"
"github.com/bytedance/fedlearner/deploy/kubernetes_operator/pkg/apis/fedlearner.k8s.io/v1alpha2"
"github.com/bytedance/fedlearner/deploy/kubernetes_operator/pkg/operator"
trainutil "github.com/bytedance/fedlearner/deploy/kubernetes_operator/pkg/u... |
fac3eea2ed0fa24410f69bef5e31ec270020cce4 | 3161861865042bc4496d71819ffe48d6d086b1af | huiwq1990/rbac-manager | /cmd/manager/main.go | Go | go | 3,281 | permissive | /*
Copyright 2018 FairwindsOps 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, softwa... |
e3051087252701b0c35c14da3d435d5a979c8f1a | 7eb12bc2ea8d49ed5f7b9ad20c5bb012fd0c988d | CloudKarafka/cloudkarafka-manager | /server/api/topics.go | Go | go | 5,744 | permissive | package api
import (
"context"
"fmt"
"net/http"
"sort"
"strings"
"time"
c "github.com/cloudkarafka/cloudkarafka-manager/config"
mw "github.com/cloudkarafka/cloudkarafka-manager/server/middleware"
"github.com/cloudkarafka/cloudkarafka-manager/server/validators"
"github.com/cloudkarafka/cloudkarafka-manager/s... |
8e928158c670e912bbea15edd49857700b09d0df | c1dcfd000f1ae38fb8e5e1b4bd6cc9045046d4a8 | kelseyhightower/gophercon-2018 | /helloworld/cloud-functions/function_test.go | Go | go | 584 | permissive | package function
import (
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
)
func TestF(t *testing.T) {
r := httptest.NewRequest("GET", "/", nil)
w := httptest.NewRecorder()
handler := http.HandlerFunc(F)
handler.ServeHTTP(w, r)
resp := w.Result()
if resp.StatusCode != http.StatusOK {
t.Errorf("wron... |
0cad9008986fa60f76eb03c90fc1d04e57476117 | 6bbfc1c2344d26a809e907167128be69245f88e8 | jsteemann/kube-arangodb | /pkg/util/k8sutil/services.go | Go | go | 9,766 | permissive | //
// DISCLAIMER
//
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
//
// 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 require... |
6f81eda608769beb050de34906a90eea596ede6e | e39c7cfe8186d2589eae7ab48c3483c360cf5c10 | 7phs/aanda-golang-sdk | /test/hotelListRequest_test.go | Go | go | 309 | permissive | package test
import (
"testing"
"github.com/nbio/st"
)
func TestHotelListRequest_ok(t *testing.T) {
testRequest("hotelListRequest_answOk.txt")
data, err := zApi.HotelListRequest(1)
st.Expect(t, err, nil)
st.Expect(t, data[0].HotelCode, "12360")
st.Expect(t, data[0].HotelName, "А-Хостел")
}
|
8e691ab107c6c8c1031f8b5d34e61c3a8165de25 | 8e3971eca20fcb22d745014ef90faeae56b2a1d1 | coopernurse/dino | /cmd/dinorepl/dinorepl.go | Go | go | 3,320 | no_license | package main
import (
"bufio"
"bytes"
"fmt"
"github.com/coopernurse/dino"
"os"
"strconv"
"strings"
)
func main() {
fmt.Println("Welcome to dino - type help for help screen")
repl()
}
func repl() {
c := &context{}
for {
fmt.Println(eval(read(), c))
}
}
func read() string {
reader := bufio.NewReader(os... |
fccc09535427759ef03c3abef8b53f031e235d23 | 439948fe8ea8d56db8aaac21daed775679290fd0 | bittersweet/rtorrent-web | /rtorrent.go | Go | go | 7,697 | no_license | package main
import (
"fmt"
"log"
"net"
"net/http"
"net/url"
"os"
"os/exec"
"strings"
"time"
"github.com/bittersweet/rtorrent-web/util"
"github.com/bittersweet/xmlrpc"
"github.com/dustin/go-humanize"
"github.com/gorilla/mux"
)
var client *xmlrpc.Client
var trackers = map[string]string{}
var torrentStor... |
a310c3194b85c5f759a7901682e2c39e17f50eb3 | 9101a1af19879cbf106000b9502995ee91f7e454 | isabella232/fs-repo-migrations | /ipfs-10-to-11/_vendor/github.com/ipfs/go-bitswap/internal/session/sessionwantsender.go | Go | go | 22,367 | permissive | package session
import (
"context"
bsbpm "github.com/ipfs/fs-repo-migrations/ipfs-10-to-11/_vendor/github.com/ipfs/go-bitswap/internal/blockpresencemanager"
cid "github.com/ipfs/fs-repo-migrations/ipfs-10-to-11/_vendor/github.com/ipfs/go-cid"
peer "github.com/ipfs/fs-repo-migrations/ipfs-10-to-11/_vendor/github.... |
a2299f080b298acd61319f4de03192a2110b29d0 | c6e23d2752c7b44ab72ec0da196c44e47ae89679 | g-harel/coco | /internal/table/format_test.go | Go | go | 791 | permissive | package table
import (
"testing"
"github.com/g-harel/coco/internal/assert"
)
func TestTableFormatCell(t *testing.T) {
tt := []struct {
Description string
Input interface{}
Expected string
}{
{"should produce empty string for nil", nil, ""},
{"should not change string formatting", "test", "test... |
fe8a087448285d0204fdddd75077015115dec155 | aa1b0a0ee66366135ff916d27c35260f49890f96 | zcoderr/AndroidPackageTool | /src/shield/jiagubao.go | Go | go | 991 | no_license | package shield
import (
"bytes"
"channel"
"common"
"fmt"
)
func JiaGuBaoSheild(apkPath string, targetName string) {
var bt bytes.Buffer
fmt.Println("开始 360 加固...")
bt.WriteString("java -jar asset/jiagu/jiagu.jar -login ")
bt.WriteString(common.Conf.Config360.Username)
bt.WriteString(" ")
bt.WriteString(comm... |
3a02e9085e5388a0507895fa88994714af664c5c | f71600e4afa7505f9902c15d21e3b941b88bdb8e | jxu86/fabric-gm | /gossip/privdata/distributor_test.go | Go | go | 7,319 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package privdata
import (
"errors"
"fmt"
"testing"
proto "github.com/hyperledger/fabric-protos-go/gossip"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go/transientstore"
"github.com/jxu8... |
b459b7e4705a40497d3152a123a10ff621b9dbeb | b792f7a36b2f38a38e404c14b1e6630f927980b2 | wanggudlak/vhzuo_uims_http | /conf/sms.go | Go | go | 1,467 | permissive | package conf
import "uims/pkg/env"
const (
SMS_ALI_DRIVER = "aliyun"
SMS_ALI_SIGN = "微桌"
SMS_ALI_VERIFY_CODE_TEMPLATE_ID = "SMS_169101455"
)
type sms struct {
smsdriver string
smsks interface{}
}
type smsAli struct {
smsAliRegionID string
smsAliAccessKey string
... |
89c8b921e2dc505263edcbd2d7502d2bd937f281 | cfcc9ddfc66ad33fd346babd7ef5d453bd8c3222 | LIP-Computing/gophercloud | /openstack/compute/v2/extensions/extendedserverattributes/testing/requests_test.go | Go | go | 1,264 | permissive | package testing
import (
"fmt"
"net/http"
"testing"
"github.com/samuelbernardolip/gophercloud/openstack/compute/v2/extensions/extendedserverattributes"
"github.com/samuelbernardolip/gophercloud/openstack/compute/v2/servers"
th "github.com/samuelbernardolip/gophercloud/testhelper"
fake "github.com/samuelbernard... |
5beada2d81df39db30f7ff21d7d58e79e7d1e60e | e3b7d8e268c2ff0456e0c21f73b172f60bd9f072 | Arhat109/goCalcHypotenouse | /calcService/calcService.go | Go | go | 8,391 | no_license | package calcService
import (
"context"
"fmt"
dch "github.com/Arhat109/goCalcHypotenuse/doubleChan"
"sync"
)
// Интерфейс горутин для вычисления гипотенуз треугольников и всего подряд за три операции с каналами:
type IDChanCalculator interface {
// поставка данных в канал вычисления квадратов катетов из поставщик... |
c4a00b14a724613ac1f0f13570cff8630506535c | dedccb94cc3e0ab8d7c22c78e5c1b2f29d80f3a8 | SunYongJun/leetcode | /findItinerary.go | Go | go | 1,962 | no_license | package leetcode
/**
332. 重新安排行程
给定一个机票的字符串二维数组 [from, to],子数组中的两个成员分别表示飞机出发和降落的机场地点,对该行程进行重新规划排序。所有这些机票都属于一个从 JFK(肯尼迪国际机场)出发的先生,所以该行程必须从 JFK 开始。
提示:
如果存在多种有效的行程,请你按字符自然排序返回最小的行程组合。例如,行程 ["JFK", "LGA"] 与 ["JFK", "LGB"] 相比就更小,排序更靠前
所有的机场都用三个大写字母表示(机场代码)。
假定所有机票至少存在一种合理的行程。
所有的机票必须都用一次 且 只能用一次。
示例 1:
输入:[["MUC", ... |
cdcf97b4668eb903308a853d3b9e7ff5fd06946f | 4694d0a8c269b3968b2d68da8deb65c58457d54b | topazus/a-tour-of-go | /exercise-images-2.go | Go | go | 412 | no_license | package main
import (
"golang.org/x/tour/pic"
"image"
"image/color"
)
type Image struct{x, y int}
func (i Image) Bounds() image.Rectangle {
return image.Rect(0, 0, i.x, i.y)
}
func (i Image) At(x, y int) color.Color {
v := uint8(x*y)
return color.RGBA{v, v, 255, 255}
}
func (i Image) ColorModel() color.M... |
c15ddad13ed3b1bf884de4a5633bf15053e67f0b | 047f4901d758dbd51872785dc48cb0c49976b40e | jiangkaihua/volcano | /vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.tasks.list.go | Go | go | 6,717 | 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 ... |
c33a0648f402c0085fc10739e3964826e9fc2e97 | 297642f2c01f6d1b945eabd39228f4f20b9e3a69 | is00hcw/goa | /goagen/gen_main/command.go | Go | go | 1,456 | permissive | package genmain
import (
"github.com/goadesign/goa/goagen/codegen"
"github.com/goadesign/goa/goagen/meta"
)
var (
// AppName is the name of the generated application.
AppName string
// TargetPackage is the name of the generated Go package.
TargetPackage string
// Force is true if pre-existing files should be... |
e404899cff5144f4d61acc1861412e2e765467e0 | 9ab440398bb9971b11898c45dedaa6d6412a9e8b | dantin/cubit | /model/serializer/serializer_test.go | Go | go | 1,001 | permissive | package serializer
import (
"bytes"
"encoding/gob"
"reflect"
"testing"
"github.com/stretchr/testify/require"
)
type mockType struct {
someField string
}
func (t *mockType) FromBytes(buf *bytes.Buffer) error {
dec := gob.NewDecoder(buf)
return dec.Decode(&t.someField)
}
func (t *mockType) ToBytes(buf *bytes... |
ce60a8bf764178ec94f9eb6f745669911fd91d11 | 498299e6e36107b307795d161359c736fe3923d5 | JorgeAmbrocio/MIAProyectoFase1 | /analizador/arbol/chgrp.go | Go | go | 2,216 | no_license | package arbol
import (
"fmt"
"strconv"
"strings"
)
// mkdisk estructura de la instrucción mkdisk
type chgrp struct {
usr string
pwd string
grupo string
}
// MatchParametros adjudica los parámetros en lista
// a los atributos del struct mkdisk
func (i *chgrp) MatchParametros(lp []Parametro) {
for _, p := r... |
f2f89eedc69c03d6367351d057e86d8e318ac7eb | d489f3b0c5d6a1294f84a7eb2368770777bfe188 | wenjy/go_test | /basic_types.go | Go | go | 369 | no_license | package main
import (
"fmt"
"math/cmplx"
)
var (
ToBe bool = false
MaxInt uint64 = 1<<64 - 1
z complex128 = cmplx.Sqrt(-5 + 12i)
)
func main() {
const f = "%T(%v)\n"
fmt.Printf(f, ToBe, ToBe)
fmt.Printf(f, MaxInt, MaxInt)
fmt.Printf(f, z, z)
var i int
var fl float64
var b bool
var s st... |
e38e629eba31cdbf4adf2f3f2a840f57e943170e | ed998e90c80b083b7641f6f725d103817ed04fcd | ukd1/gcd | /gcdapi/console.go | Go | go | 5,028 | permissive | // AUTO-GENERATED Chrome Remote Debugger Protocol API Client
// This file contains Console functionality.
// API Version: 1.1
package gcdapi
import (
"github.com/wirepair/gcd/gcdmessage"
)
// Console message.
type ConsoleConsoleMessage struct {
Source string `json:"source"` ... |
78cec574e6ec3d3558643c63762f2aa85835b1d0 | cb001f7a2ab74712df53d5d74d4e3a172c279a30 | gonum/website | /static/code/word_ladders/words-2a/main.go | Go | go | 5,589 | permissive | // words-2a is a simple graph-based program to find all word shortest
// ladders between pairs of words in a dictionary. It stores words as
// nodes within the graph, edges are implied by Hamming distance and
// are enumerated lazily when neighbouring nodes are queried.
package main
import (
"bufio"
"bytes"
"flag"
... |
098f9443fa976aade2e1b2a98fbc7335324f05b0 | 0ef0b573e1bb29b095909f46fb163d5d8040db05 | ijihang/tidb | /util/chunk/row_container.go | Go | go | 14,599 | permissive | // Copyright 2018 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
98c711fb25d4638e30b0d7c6f08a8ca0c14d1236 | 8b732932e87ac47ca32989f20e7187a3a73225ad | jeefy/osde2e | /vendor/github.com/openshift-online/ocm-sdk-go/accountsmgmt/v1/subscription_builder.go | Go | go | 9,346 | permissive | /*
Copyright (c) 2019 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... |
8ce80fb553658603889e71fe1a3aaf590d430a42 | 5f377eb5df1619c995308b275431082539bf9c71 | jcimafranca/platform-client-sdk-cli | /build/gc/cmd/outbound_schedules_campaigns/outbound_schedules_campaigns.go | Go | go | 8,800 | permissive | package outbound_schedules_campaigns
import (
"fmt"
"github.com/mypurecloud/platform-client-sdk-cli/build/gc/logger"
"github.com/mypurecloud/platform-client-sdk-cli/build/gc/retry"
"github.com/mypurecloud/platform-client-sdk-cli/build/gc/services"
"github.com/mypurecloud/platform-client-sdk-cli/build/gc/utils"
"... |
d3de8d7e489471bfcbe8c2b4dff3aac404a6188d | d86e0d166f3056878f8f2f28433b830bc526cc56 | frlute/leetcode | /src/16.3-sum-closest.go | Go | go | 911 | no_license | /*
* @lc app=leetcode id=16 lang=golang
*
* [16] 3Sum Closest
*/
// @lc code=start
func threeSumClosest(nums []int, target int) int {
length := len(nums)
if length < 3 {
return 0;
}
sort.Ints(nums);
closest := math.MaxInt32
abs := func(x int) int {
if x < 0 {
return -1 * x
}
return x
}
update... |
41c3cd1bd9e5061f7c90e8a261c284d15d40f211 | bb0d1078ee926a244c5efd164a46370797930a51 | rexshan/tarsgo | /tars/protocol/res/configf/Config_IF.go | Go | go | 34,132 | no_license | //Package configf comment
// This file war generated by tars2go 1.1
// Generated from Config.tars
package configf
import (
"context"
"fmt"
m "github.com/rexshan/tarsgo/tars/model"
"github.com/rexshan/tarsgo/tars/protocol/codec"
"github.com/rexshan/tarsgo/tars/protocol/res/requestf"
"github.com/rexshan/tarsgo/ta... |
b3c5cad5675c04707cdc2a58deefcf3d6a54373f | de85c39c198c6dbd3b720e017a50d54c11e5886f | HunkevychPhilip/toDo-go | /cmd/main.go | Go | go | 1,496 | no_license | package main
import (
"github.com/HunkevychPhilip/todo/pkg/handler"
"github.com/HunkevychPhilip/todo/pkg/repository"
"github.com/HunkevychPhilip/todo/pkg/service"
"github.com/HunkevychPhilip/todo/pkg/utils"
"github.com/HunkevychPhilip/todo/server"
"github.com/joho/godotenv"
_ "github.com/lib/pq"
"github.com/si... |
315a8950a0b7bd79f319dda8c313d99a3862b69d | 1c4522962f8334ca056854f932afed18b1fce8ae | Colstuwjx/golang-examples | /src/grpc/client.go | Go | go | 2,580 | permissive | package main
import (
"io"
"log"
"golang.org/x/net/context"
"google.golang.org/grpc"
pb "github.com/Colstuwjx/golang-examples/src/grpc/customer"
)
const (
address = "localhost:50051"
)
// createCustomer calls the RPC method CreateCustomer of CustomerServer
func createCustomer(client pb.CustomerClient, custom... |
9e629327ea75344f7563da93a82da7905fa068bf | 52ec142b0b0adb41f78ac5636b3def75855a1288 | sipki-tech/tg | /domain/chosen_inline_result.go | Go | go | 1,194 | no_license | package domain
// ChosenInlineResult Represents a result of an inline query that was chosen by the user and sent to their chat partner.
// Note: It is necessary to enable inline feedback via @Botfather in order to receive these objects in updates.
// Payments.
// Your bot can accept payments from Telegram users.
// Pl... |
8b0fcd089a2e42760de1e1d1b0f7c1cb1cc02759 | 013427456f98df3c19f6d2f774236318287269e9 | mhchia/go-libp2p-core | /crypto/key_test.go | Go | go | 3,470 | permissive | package crypto_test
import (
"bytes"
"crypto/rand"
"testing"
. "github.com/libp2p/go-libp2p-core/crypto"
pb "github.com/libp2p/go-libp2p-core/crypto/pb"
"github.com/libp2p/go-libp2p-core/test"
)
func TestKeys(t *testing.T) {
for _, typ := range KeyTypes {
testKeyType(typ, t)
}
}
func testKeyType(typ int, ... |
211c112e7fa27487bf120ff04f2b84e933088401 | 94d2edb971148786fa4e2d1ca3490f6d8af7d42d | isabella232/wecarry-api | /application/models/message_test.go | Go | go | 10,085 | permissive | package models
import (
"testing"
"time"
"github.com/gobuffalo/events"
"github.com/gobuffalo/validate"
"github.com/silinternational/wecarry-api/domain"
)
func (ms *ModelSuite) TestMessage_Validate() {
t := ms.T()
tests := []struct {
name string
message Message
want *validate.Errors
wantErr ... |
14a6bc76933d89e1739179b70489d6e2efd634c8 | 1ac45dc69a1018ae296a45b3ac44e76222e1c320 | cortexproject/cortex | /pkg/chunk/cache/cache_gen_test.go | Go | go | 835 | permissive | package cache
import (
"context"
"testing"
"github.com/stretchr/testify/require"
)
func TestCacheGenNumCacheKeysPrefix(t *testing.T) {
keys := []string{"foo", "bar", "baz"}
for _, tc := range []struct {
name string
prefix string
}{
{
name: "empty-prefix",
},
{
name: "with-prefix",
prefi... |
ea7bdc6310398f8de3548700d68f6b7bbb2193a2 | 146e63b8c95e1d6ac5c67d3636ae512a27d34720 | linguohua/xhh | /xhmj/proxy/proxy.go | Go | go | 4,517 | no_license | package proxy
import (
"encoding/binary"
"errors"
proto "github.com/golang/protobuf/proto"
"github.com/gorilla/websocket"
log "github.com/sirupsen/logrus"
"net"
"sync"
"time"
)
const (
websocketWriteDeadLine = 5 * time.Second
tcpWriteDeadLine = 5 * time.Second
)
// pairHolder hold w... |
6b33071e3ecc19251932713a2cf6121113504e63 | 36e81284dff89865175c5b36cc1c47611d6f3c01 | ryanthecubfan/cluster-api | /controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_types_test.go | Go | go | 3,313 | permissive | /*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
09d36c9c0b81e0a405d28f24c98fbc01722bafea | 350b3350c3907e60a292193c8de9c93696ee38c5 | owenthereal/upterm | /vendor/github.com/gen2brain/beeep/notify_unix_nodbus.go | Go | go | 957 | permissive | //go:build (linux && nodbus) || (freebsd && nodbus) || (netbsd && nodbus) || (openbsd && nodbus)
// +build linux,nodbus freebsd,nodbus netbsd,nodbus openbsd,nodbus
package beeep
import (
"errors"
"os/exec"
)
// Notify sends desktop notification.
func Notify(title, message, appIcon string) error {
appIcon = pathAb... |
d725ccc6c12a01e8466c9bdb1a9964468a924ecb | 5ebffa9e5bf6860158b4a7358ea8c5d2babc910f | zhangjian31/go-test | /go_demo1/shuzu.go | Go | go | 502 | no_license | package main
import "fmt"
func main() {
//数组声明
var balance1 [10] int
//数组初始化
//1.{}中的元素个数不能大于【】中的数字
var balance2 = [5]int{1,2,3,4,5}
//2.[]中不设置数组大小,根据元素个数设置书序大小
var balance3 = [...]int{1,2,3,4,5,6,7,8,9}
fmt.Println(balance1)
fmt.Println(balance2)
fmt.Println(balance3)
var n [10]int
var i,j int
for ... |
3196adac2fb70ba7b5add93f3ee8b3a3620a6935 | ae72dbbefaa7bf4ddafd52bbb758f86b06c3affc | cm4r1v3r/gogoclub | /scanner/slow_scan/main.go | Go | go | 257 | no_license | package main
import (
"fmt"
"net"
)
func main() {
for i := 1; i <= 1024; i++ {
address := fmt.Sprintf("scanme.nmap.org:%d", i)
conn, err := net.Dial("tcp", address)
if err != nil {
continue
}
conn.Close()
fmt.Printf("%d open\n", i)
}
}
|
79ae9235de46dc061417ed43074b71a4011e0c62 | f12ca8bf3ab0404fef6bfe41f20e9973fd9b3600 | prrn-pg/Shojin | /Practice/atcoder/others/sumitrust2019/src/d.go | Go | go | 1,575 | no_license | package main
import (
"bufio"
"fmt"
"os"
"reflect"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
func main() {
sc.Split(bufio.ScanWords)
defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
/* --- code ---*/
// TLEとれないので答え見た がびーん 過去に解けてたのに....
... |
fb0acc6d3b4d31594f22db86540533d38d3df1d7 | 137198a42b39cbb58d39fd8d7fa25a1d45e4f851 | pacoxu/kubernetes | /test/e2e/scheduling/preemption.go | Go | go | 36,049 | 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, ... |
44cb7f39fff16e7ea8c33bc9c243abbd5f20d88e | ab855d7b6b5a3fd8440d447a04d5f4986fc713c8 | alexyu0/bess | /deps/reedsolomon/matrix.go | Go | go | 6,890 | permissive | /**
* Matrix Algebra over an 8-bit Galois Field
*
* Copyright 2015, Klaus Post
* Copyright 2015, Backblaze, Inc.
*/
//package reedsolomon
package main
import "C"
import (
"errors"
"fmt"
"strconv"
"strings"
)
// byte[row][col]
type matrix [][]byte
// newMatrix returns a matrix of zeros.
func newMatrix(rows... |
295898825efbdbd3da9aa834e3d1ef18d150560e | 9de539cf50b7425ad48b23bba60cec2345f38ca3 | johnswan/voyager | /pkg/ingress/parser.go | Go | go | 12,972 | permissive | package ingress
import (
"encoding/json"
goerr "errors"
"strconv"
"strings"
"github.com/appscode/errors"
"github.com/appscode/go/arrays"
"github.com/appscode/go/crypto/rand"
stringutil "github.com/appscode/go/strings"
"github.com/appscode/log"
"github.com/appscode/voyager/api"
_ "github.com/appscode/voyage... |
92cc8d44c555a20d37c378077cf8d493627c489a | 2cde482e601e3b708ed6cce600663d527312a392 | gtechx/quic-go | /streams_map_test.go | Go | go | 25,820 | permissive | package quic
import (
"errors"
"sort"
"github.com/lucas-clemente/quic-go/internal/mocks"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/qerr"
"github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Streams Map", func... |
3d9662e60e5226f656d36e8b77e16e89d36dd2d7 | aadcd01a09e9c0c4a24b39e93d3e9a38142ad855 | jreece1567/go_swagger_client | /client_core/c_u_r_a_t_i_o_n_s/get_curations_curation_id_parameters.go | Go | go | 1,999 | permissive | package c_u_r_a_t_i_o_n_s
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/swag"
s... |
101d056a8011e7fcda356b594fd814b6e0abc411 | acf9bf663274f7c039ad98d439c8474f55ff1a9b | ellcrys/docker | /builder/dockerignore/dockerignore.go | Go | go | 1,578 | permissive | package dockerignore // import "github.com/ellcrys/docker/builder/dockerignore"
import (
"bufio"
"bytes"
"fmt"
"io"
"path/filepath"
"strings"
)
// ReadAll reads a .dockerignore file and returns the list of file patterns
// to ignore. Note this will trim whitespace from each line as well
// as use GO's "clean" f... |
0207c52343dd3cfc8d82ea1468e67c521d80958e | 06a729e26295e526ba4f04c3f1bd6476b0ca8097 | Cofresi/aergo | /p2p/p2putil/loggingutil.go | Go | go | 4,480 | permissive | /*
* @file
* @copyright defined in aergo/LICENSE.txt
*/
package p2putil
import (
"fmt"
"github.com/aergoio/aergo-lib/log"
"github.com/aergoio/aergo/p2p/p2pcommon"
"github.com/rs/zerolog"
)
// Deprecated
func DebugLogReceiveMsg(logger *log.Logger, protocol p2pcommon.SubProtocol, msgID string, peer p2pcommon.R... |
bc1083c52b1b146b054e8d9ea1b1bd0cf52b5935 | bfe7999350c1dffb581df9e87a96fb16b5ddf7e7 | JaidenChiang/istio | /pilot/pkg/networking/core/v1alpha3/listener_builder.go | Go | go | 27,130 | permissive | // Copyright Istio 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 l... |
1b61e3ba9d0f91d0af98eb70438fac1f7ecc5f17 | a4128f2f47d71ba707be51f50ffe3875a30653a3 | lshmouse/onecloud | /pkg/multicloud/openstack/novastorage.go | Go | go | 2,760 | permissive | // Copyright 2019 Yunion
//
// 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 writi... |
e8af21db3f4c0d1c62b357e4be917b268637709f | d7f129dfb5d3a063bb039e1fd025c8288ecba5de | CharlesWin/UsersTest | /internal/database/database.go | Go | go | 1,230 | no_license | package database
import (
. "UsersTest/internal/config"
"UsersTest/internal/parser"
"database/sql"
"fmt"
_ "github.com/mattn/go-sqlite3"
"strconv"
)
func GetFromId(id int) (*parser.User, error) {
db, err := sql.Open("sqlite3", GetInstance().DataBase.Path)
if err != nil {
return nil, err
}
defer db.Close()... |
15d10b2be5a32edc1e076b31399ad4aa5a868f5d | bbc78eca459c55a65c8161c2cea492a6aa9eef64 | kingpro/ui | /stack.go | Go | go | 5,667 | permissive | // 13 february 2014
package ui
import (
"fmt"
"sync"
)
type orientation bool
const (
horizontal orientation = false
vertical orientation = true
)
// A Stack stacks controls horizontally or vertically within the Stack's parent.
// A horizontal Stack gives all controls the same height and their preferred width... |
e8472b70565a65b6d1e8519946b98fd86cf60e14 | e821fd3eebce0e7bcf5aadd05e4a9c1c6097c696 | godlei/GoLeetcode | /src/main/main.go | Go | go | 347 | no_license | package main
import "GoLeetcode/src/leetcode"
func main() {
//leetcode.Problem1()
//leetcode.Problem7()
//leetcode.Problem2()
leetcode.Problem22()
//example.StringExample()
//example.StructExample()
//example.FunctionTest()
//example.SortExample()
//example.ListExample()
//example.InterfaceExample()
//exam... |
c50a6fcafa607870cbe20f67e58176b5597a7391 | ecb9d3d30bda6819c6d798e22c8b36078f2945ec | cnguyen6-certify/scope | /prog/main.go | Go | go | 20,188 | permissive | package main
import (
"compress/gzip"
"flag"
"fmt"
"net"
"os"
"regexp"
"runtime"
"strconv"
"strings"
"time"
log "github.com/Sirupsen/logrus"
billing "github.com/weaveworks/billing-client"
"github.com/weaveworks/scope/app"
"github.com/weaveworks/scope/app/multitenant"
"github.com/weaveworks/scope/commo... |
604af7c9e9fe6c85cd99eced59a6681a7816e251 | 0d320d1419fbe7695c8b842f347f9531db48f1aa | turtacn/alameda | /datahub/pkg/dao/repositories/influxdb/gpu/nvidia/predictions/nvidia_gpu_temperature_celsius_lower_bound.go | Go | go | 4,746 | no_license | package predictions
import (
EntityInfluxGpuPrediction "github.com/turtacn/alameda/datahub/pkg/dao/entities/influxdb/gpu/nvidia/predictions"
DaoGpu "github.com/turtacn/alameda/datahub/pkg/dao/interfaces/gpu/influxdb"
RepoInflux "github.com/turtacn/alameda/datahub/pkg/dao/repositories/influxdb"
DatahubUtils "github... |
1a17e96db256423de3b66d1510c07b5e15b2ee08 | 2c60b32262bc80ad6dd8cdad64c730dc5f17d537 | ikorniushko/artr | /x/bank/alias.go | Go | go | 2,394 | no_license | package bank
// nolint
import (
"github.com/arterynetwork/artr/x/bank/internal/keeper"
"github.com/arterynetwork/artr/x/bank/internal/types"
)
const (
QueryBalance = keeper.QueryBalance
QueryParams = keeper.QueryParams
ModuleName = types.ModuleName
QuerierRoute = types.QuerierRoute
... |
5293be7974f20c86ff6fcf68870540ec5da6fb62 | 65e4924482cb550c44405071d15e1e8040f11346 | dahliaOS/fuchsia-pi4 | /src/connectivity/network/netstack/ndp.go | Go | go | 24,573 | permissive | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// +build !build_with_native_toolchain
package netstack
import (
"context"
"errors"
"fmt"
"sync"
"time"
"go.fuchsia.dev/fuchsia/src/connectivity/n... |
160b504265ab30b6bf89c37cee01967cac77cb0a | be8e9a42103c408a36dc51a73bb084567fefbe86 | shimaomao/Instafig | /models/dbmodelbase.go | Go | go | 4,273 | no_license | package models
import (
"fmt"
"log"
"path/filepath"
"strconv"
"strings"
"github.com/Instafig/Instafig/conf"
xormcore "github.com/go-xorm/core"
"github.com/go-xorm/xorm"
_ "github.com/mattn/go-sqlite3"
)
var (
dbEngineDefault *xorm.Engine
)
func getSerialNumFromSlaveSqliteFile(fn string) int {
ix := strin... |
638c5a1c22389ec689c941bdd0f144b202045b55 | 6591317e1b6f8ab437fee8586e37e249c0165dc8 | akram/kubernetes-client | /kubernetes-model-generator/kubernetes-model-networking/cmd/generate/generate.go | Go | go | 5,068 | permissive | /**
* Copyright (C) 2015 Red Hat, 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... |
3101ff095937564c1ee9a9506ea4e72bed1d8a77 | bb38e1e65449188e76122ffadab410260052b04c | podhmo/individual-sandbox | /daily/20230107/example_go/03required/main.go | Go | go | 2,381 | no_license | package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"strings"
)
type S struct {
Name string `json:"name" required:"true"`
Age int `json:"age"`
}
func (s *S) UnmarshalJSON(b []byte) error {
if err := requiredCheck(b, "name"); err != nil {
return err
}
type t S
return json.Unmarshal(b, (*t)(s))
... |
490181a5403b60ccb8f3689309c5a56529449158 | 91f396f7fe2b15779b8d38a4d2670b759d2e2a8d | sgtest/monorepo-test-3 | /kubernetes-11/pkg/client/listers/core/internalversion/node.go | Go | go | 2,011 | 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, ... |
9d637cd7774937d3de55682d3ee29bbb94b47b23 | 5b000df37da3e3c77fa983550c5e39f8e18c9598 | cuijxin/appservice | /resources/resources.go | Go | go | 2,644 | no_license | package resources
import (
appv1alpha1 "github.com/cuijxin/appservice/api/v1alpha1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)
func NewDeploy(app *appv1alpha1.AppService) *appsv1.Deployment {
labels := map[stri... |
2467e379a711b76c17e65c93e4a687a3d4d98261 | 065764e3bde3000e6f2d156c57548388ad33d87c | duzhanyuan/RationalDb | /vt/kvengine/connection.go | Go | go | 13,722 | no_license | package kvengine
import (
"github.com/senarukana/rationaldb/vt/kvengine/proto"
)
type DBConnection struct {
connectionParams *proto.DbConnectParams
proto.DbConnection
}
/*func buildValue(bytes []byte, filedType uint32) sqltypes.Value {
switch filedType {
case schema.TYPE_FRACTIONAL:
return sqltypes.MakeFracti... |
97281bba6acbe170e797738dc7075218b76ebd16 | 078a98fcd5a35116941b4134835393af0de24dff | znjuko/chranyh-tp-db | /internal/models/message.go | Go | go | 383 | no_license | package models
type Message struct {
Author string `json:"author,omitempty"`
Created string `json:"created,omitempty"`
Forum string `json:"forum,omitempty"`
Id int64 `json:"id,omitempty"`
IsEdited bool `json:"isEdited,omitempty"`
Message string `json:"message,omitempty"`
Parent int64 `json:"p... |
7110c2d4c5a8575dd6333cf4dd1da1117dd627ce | 82149c50a5fa87f394bcb6c8507ebb62b4acc0a0 | nonCriticInc/heimdall | /pkg/v1/organization.go | Go | go | 5,039 | no_license | package v1
import (
"errors"
"github.com/go-bongo/bongo"
"github.com/labstack/echo"
"github.com/nonCriticInc/heimdall/config"
"github.com/twinj/uuid"
"gopkg.in/mgo.v2/bson"
"log"
)
//apis
func CreateOrganizations(context echo.Context) error {
organizationDtoList, err := getCreateOrganizationDtoListFromContext... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.