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 |
|---|---|---|---|---|---|---|---|---|
84d4f8a5771fbff07d2e8dfb2f3a6099ad93f0e0 | 12feadb70c09fb9ac9b5865c6a99f5e054d719b9 | m-lab/tcp-info | /cache/cache_test.go | Go | go | 2,518 | permissive | package cache_test
import (
"encoding/json"
"log"
"testing"
"github.com/m-lab/tcp-info/cache"
"github.com/m-lab/tcp-info/netlink"
)
func init() {
// Always prepend the filename and line number.
log.SetFlags(log.LstdFlags | log.Lshortfile)
}
func testFatal(t *testing.T, err error) {
if err != nil {
t.Fatal... |
d5e303d187ecde1470e0814566db55038c431bd9 | f08905972b0a1da4227b54207b0bb61794f9c61b | CalmBit/zxing-go | /core/common/bit_matrix_test.go | Go | go | 12,167 | permissive | /*
* Copyright 2007 ZXing 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 ... |
605d41967ec78d99786486e2b9ae1f1971642bb6 | c95a5b5458dce5dd4bd0d97683a049f74f5c26ee | umhau/iv | /apl/xgo/convert.go | Go | go | 2,548 | no_license | package xgo
import (
"fmt"
"reflect"
"github.com/ktye/iv/apl"
"github.com/ktye/iv/apl/numbers"
)
// Exporter can be implemented by an apl.Value to be able convert it to a go value.
type Exporter interface {
Export() reflect.Value
}
// export converts an apl value to a go value.
func export(a *apl.Apl, v apl.Va... |
221a3ca6c75d252a4a9ff4911b5efb80ce40ffac | fe3b549d5c268edf212cdaf67ddd2cfec5d79518 | GuohaoMa/go-swan-provider | /common/utils/utils.go | Go | go | 3,101 | permissive | package utils
import (
"encoding/json"
"io/ioutil"
"math/big"
"os"
"strconv"
"strings"
"swan-provider/logs"
"time"
)
// GetEpochInMillis get current timestamp
func GetEpochInMillis() (millis int64) {
nanos := time.Now().UnixNano()
millis = nanos / 1000000
return
}
func ReadContractAbiJsonFile(aptpath stri... |
8d2107c96ffa0660641faf6ca2c529df18527ef9 | ed425aef061ed217dde183446bcefa82ec931940 | Kudistalbekov/GO-server | /models/related.go | Go | go | 478 | no_license | package models
import "gopkg.in/guregu/null.v3/zero"
//Response for client
type Response struct {
Success bool `json:"succes"`
Error string `json:"error"`
Data interface{} `json:"data"`
}
//ResponseUser for client without date and password
type ResponseUser struct {
ID zero.String `json:"i... |
0587db7efb150a60da23eefcfd706e53695c48b1 | 782537125892de025c59777c99e6be77d4f7441c | b-harvest/cosmos-module-stress-test | /client/clictx/client_test.go | Go | go | 651 | permissive | package clictx_test
import (
"os"
"testing"
"github.com/b-harvest/cosmos-module-stress-test/client/clictx"
"github.com/b-harvest/cosmos-module-stress-test/client/rpc"
"github.com/b-harvest/cosmos-module-stress-test/codec"
"github.com/test-go/testify/require"
)
var (
c *clictx.Client
rpcAddress = "http://lo... |
7b128e72304118001eb50b7d747bf024622145b4 | 2f068e0376e82133bafef7dba6c51f8358141010 | y894577/Gee | /geeorm/table_test.go | Go | go | 761 | no_license | package geeorm
import (
"fmt"
_ "github.com/mattn/go-sqlite3"
"testing"
)
type User struct {
Name string `geeorm:"PRIMARY KEY"`
Age int
}
func TestSession_CreateTable(t *testing.T) {
engine, _ := NewEngine("sqlite3", "gee.db")
defer engine.Close()
s := engine.NewSession()
_, _ = s.Raw("DROP TABLE IF EXISTS... |
58b54d6f4be68cbfb6aa6b047a33447105e1b9f5 | 12fb5662159a8c44eb893f78941aa1298c056b1f | sallyom/installer | /terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/sdk/resource.go | Go | go | 7,149 | permissive | package sdk
import (
"context"
"time"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/resourceid"
"github.com/ha... |
4e2c027682a54d7558d5b326e5e39e7ab64987fb | 687b105835a1fe6639a560e3fa75be7b2bd98c57 | danielpk74/goblog | /src/api/router/routes/posts_routes.go | Go | go | 791 | no_license | package routes
import (
"api/controllers" // Check this dependency.
"net/http"
)
var postsRoutes = []Route{
Route{
Uri: "/posts",
Method: http.MethodGet,
Handler: controllers.GetPosts,
AuthRequired: false,
},
Route{
Uri: "/posts",
Method: http.MethodPost,
Handler... |
43e1d30b0a84c0a489e29ea93d315d172e4296b8 | a75704d3ce6eabc1b2b0d46774cf33338537c1a3 | HashCell/cloudgo | /models/article.go | Go | go | 1,790 | no_license | package models
import (
"github.com/jinzhu/gorm"
"time"
)
type Article struct {
Model
// 外键
TagID int `json:"tag_id" gorm:"index"`
// 关联查询
Tag Tag `json:"tag"`
Title string `json:"title"`
Desc string `json:"desc"`
Content string `json:"content"`
CreatedBy string `json:"created_by"`
ModifiedBy string `js... |
3517691bd9c65d474be3becbf1b22cdeb3ec513f | eb1f656f6ded43111f1e926cf744b7cca040389d | xjdrew/greydog | /main.go | Go | go | 1,057 | no_license | package main
import (
"log"
"time"
"github.com/gofinance/ib"
)
func main() {
opts := ib.EngineOptions{
Gateway: "localhost:7496",
DumpConversation: true,
}
engine, err := ib.NewEngine(opts)
if err != nil {
log.Fatalf("ib.NewEngine: %s", err)
}
defer engine.Stop()
manager, err := ib.NewPrim... |
fd966dc2b217ffec29ba43f0b4e857550d4fe51b | 3b4428742042742960f74b0deae2cc1974baf2eb | huaweicloud/huaweicloud-sdk-go-v3 | /services/iotanalytics/v1/model/model_show_batch_job_response.go | Go | go | 1,515 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// ShowBatchJobResponse Response Object
type ShowBatchJobResponse struct {
// 仅在响应返回。作业ID。
JobId *string `json:"job_id,omitempty"`
// 作业名称。只能包含数字、英文字母、中文字母、下划线以及中划线。长度为1~128。
JobName *string `json:"job_name,omitempty... |
245a4e27d4ddec958fbc0b4f270f968fb4d1db0b | 7ac1736e04539e4c461036daf05a7201e3d429dc | careJJ/control | /blockchain/block.go | Go | go | 3,267 | no_license | package main
import (
"bytes"
"crypto/sha256"
"time"
"encoding/gob"
"fmt"
)
//定义区块结构
// 第一阶段: 先实现基础字段:前区块哈希,哈希,数据
// 第二阶段: 补充字段:Version,时间戳,难度值等
type Block struct {
//版本号
Version uint64
// 前区块哈希
PrevHash []byte
//交易的根哈希值
MerkleRoot []byte
//时间戳
TimeStamp uint64
//难度值, 系统提供一个数据,用于计算出一个哈希值
Bits uint... |
9e248f86271afff85d0f08c057e5d60bffb82419 | 2b29f500d68541b47a29f533d872e7db9face409 | sbilly/tsuru | /api/logtracker_test.go | Go | go | 824 | permissive | // Copyright 2015 tsuru 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 api
import (
"time"
"github.com/tsuru/tsuru/app"
"gopkg.in/check.v1"
)
func (s *S) TestLogStreamTrackerAddRemove(c *check.C) {
c.Assert(logTracker... |
f9dc7b984ea6f3581661c347c05899545cbb3ed2 | cedbe9e921d04935a1e13358be5727eb4e90f834 | sergioifg94/integreatly-operator | /pkg/products/amqonline/authservices.go | Go | go | 626 | permissive | package amqonline
import (
"github.com/integr8ly/integreatly-operator/pkg/apis/enmasse/admin/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func GetDefaultAuthServices(ns string) []*v1beta1.AuthenticationService {
return []*v1beta1.AuthenticationService{
{
ObjectMeta: metav1.ObjectMeta{
Name: ... |
dad1971a4cf6dcd89c9564ee37d6cb4a00dc156e | deaf846b1c783ff42c8496a9ddabf25f36b16732 | niyueming/docker | /api/client/utils.go | Go | go | 5,586 | permissive | package client
import (
"encoding/base64"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
gosignal "os/signal"
"path/filepath"
"runtime"
"time"
"golang.org/x/net/context"
"github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/signal"
"github.com/docker/docker/pkg/term"
"github.com/docker/docker/regist... |
a692431d5f51dfe88fa6d324f1753940f20daca1 | 77848918a3aebc84c82f2108f0a1b05af3e546c6 | Geekoon/js_xml_creator | /marketplace/marketplace.go | Go | go | 12,391 | no_license | package main
import (
"database/sql"
"encoding/xml"
"io"
"log"
"os"
"time"
_ "github.com/go-sql-driver/mysql"
"gopkg.in/gcfg.v1"
)
var (
WarningLogger *log.Logger
InfoLogger *log.Logger
ErrorLogger *log.Logger
FatalLogger *log.Logger
)
var (
database *sql.DB
cfg Config
... |
ba55e7437760b408968922f6d951f95e5ac62a0d | 6cd32a71920e8a0486247ef901c9b3cff2a514bd | betterDuanjiawei/gopl | /ch5/defer2.go | Go | go | 290 | no_license | package main
import (
"fmt"
"os"
"runtime"
)
func main() {
defer printStack()
f(3)
}
func printStack() {
var buf [4096]byte
n := runtime.Stack(buf[:], false)
os.Stdout.Write(buf[:n])
}
func f(x int) {
fmt.Printf("f(%d)\n", x+0/x)
defer fmt.Printf("defer %d\n", x)
f(x-1)
} |
0c31f850c2fdd7b06100ea5b6a16c707a103756a | 435752110ebc850775ccd34804ddeb2d48adf8e5 | ng2dev/fabric-sdk-ext | /vault/get_key.go | Go | go | 931 | no_license | /*
Copyright Hyperledger and its contributors.
SPDX-License-Identifier: Apache-2.0
*/
package vault
import (
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/core"
"github.com/pkg/errors"
"github.com/unchainio/fabric-sdk-ext/vault/internal"
)
// GetKey returns the key this CSP associates to
// the Subj... |
d980f669354503b89e02b6d43c7a50c7526ab32c | 76d00c4ee2293cedbce689fbc81ee41456a7d923 | yext/vitess | /go/vt/dbconnpool/connection_pool.go | Go | go | 9,271 | 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... |
abf67273608f0df6cf80617c2da35f9a5ac64b80 | f0a31e2520409b5dc2298132198229b78fee2586 | ironcladlou/kubebuilder | /docs/book/src/cronjob-tutorial/testdata/project/controllers/cronjob_controller.go | Go | go | 20,161 | 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 under the License ... |
615426811259fc1ff6b20c1abd256f52dbad1591 | 4338c9458223529833f7dc72f39184d8ed2ee807 | ekmixon/cn-infra | /utils/redact/redact.go | Go | go | 1,668 | permissive | // Copyright (c) 2020 Cisco and/or its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by app... |
55d5584774b1c090f8c4c5643e8d8cd177425cd4 | 6b9a0e59dec286c183961bb9d5974466e7a4aa43 | mickeystone/my-cosmos | /x/distribution/alias.go | Go | go | 2,513 | permissive | // nolint
package distribution
import (
"my-cosmos/cosmos-sdk/x/distribution/keeper"
"my-cosmos/cosmos-sdk/x/distribution/tags"
"my-cosmos/cosmos-sdk/x/distribution/types"
)
type (
Keeper = keeper.Keeper
Hooks = keeper.Hooks
MsgSetWithdrawAddress = types.MsgSetWithdrawAddress
MsgWithdrawDelegatorRew... |
361f0fc9f3bf10579e25e5258cd15ee2face1d4d | 257a9c1cad96aa86a292ce06fb0d42f04c965082 | Grant-Steinfeld/temporal | /common/messaging/mocks/Message.go | Go | go | 2,579 | permissive | // The MIT License
//
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
//
// Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Soft... |
380d0f273503eacb3a31f26aaae177011d41b3b6 | 8041add7891ba33811c8dd5595077ad5718fe529 | OhDearMoshe/go-scrape-some-things | /extract/extract.go | Go | go | 870 | no_license | package extract
import (
"net/http"
"io/ioutil"
"log"
"golang.org/x/net/html"
"bytes"
)
/**
Extracts bytes from a http.Response
*/
func FromHttpResponse(response *http.Response) []byte{
bytes, err := ioutil.ReadAll(response.Body)
response.Body.Close()
if err != nil {
log.Fatal(err)
}
return bytes
}
... |
f0ba6b8bf5c85e79af1a6fae565608075b165966 | 133c24334e43102bf48e7420bfabc862dd1c3141 | children0001/canchain | /kernel/types.go | Go | go | 681 | no_license | //
// (at your option) any later version.
//
//
package kernel
import (
"github.com/5uwifi/canchain/kernel/state"
"github.com/5uwifi/canchain/kernel/types"
"github.com/5uwifi/canchain/kernel/vm"
)
//
type Validator interface {
// ValidateBody validates the given block's content.
ValidateBody(block *types.Block)... |
a457b000faf46fc85eee2a875cdc3545b1086558 | 1b02c2e2729b83dbae520f26f6d909c32005f7b7 | challiwill/tracker-resource | /Godeps/_workspace/src/github.com/onsi/gomega/matchers/have_suffix_matcher.go | Go | go | 1,081 | permissive | package matchers
import (
"fmt"
"github.com/concourse/tracker-resource/Godeps/_workspace/src/github.com/onsi/gomega/format"
)
type HaveSuffixMatcher struct {
Suffix string
Args []interface{}
}
func (matcher *HaveSuffixMatcher) Match(actual interface{}) (success bool, err error) {
actualString, ok := toString(... |
6d02045852a6296ca05c5e84bdeab85e88b2c603 | ce8eb0fff3a9b10f36ced6d09ac810917d591c21 | askagirl/allmark | /src/allmark.io/modules/common/tree/util_test.go | Go | go | 563 | permissive | // Copyright 2014 Andreas Koch. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tree
import (
"allmark.io/modules/common/route"
"testing"
)
func Test_RouteToPath(t *testing.T) {
// arrange
inputRoute := route.NewFromRequest("doc... |
0c8e51d15434883f378def094c70d4265304ecd1 | 45b8020558cc34c3a4c81c0c2a0fc50b9129051e | devdavidkarlsson/ladon | /condition_string_pairs_equal_test.go | Go | go | 1,507 | permissive | // Copyright © 2017 Aeneas Rekkas <aeneas+oss@aeneas.io>
//
// 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... |
0d5f88a4c471e9950542d3db61e8a644e4de78dc | 5485c6b46dcbf0e5ff162a6c4fc577492ab61141 | teresa-winter/DSGO | /extra/cbst/rbt/insert.go | Go | go | 3,217 | no_license | package rbt
//成功返回true,冲突返回false。
//红黑树插入过程包括:O(log N)的搜索,O(1)的旋转,O(log N)的平衡因子调整。
func (tr *Tree) Insert(key int32) bool {
if tr.root == nil {
tr.root = newNode(key) //默认为红
tr.root.black = true
} else {
root := tr.insert(key)
if root == nil {
return false
}
tr.rebalanceAfterInsert()
}
return true
}... |
e48e4536a30fec8e840e8f89479b58da7b89f1f0 | c87a80b9ab73485002220e706a827135bd372412 | HappyRoad/log4go | /log4go.go | Go | go | 1,613 | no_license | package log4go
import (
"fmt"
"log"
"os"
"time"
)
const (
Version = "0.0.1"
)
type LEVEL = int
const (
DEBUG LEVEL = iota
INFO
WARN
ERROR
)
type genericLogger interface {
Printf(format string, v ...interface{})
}
type Logger struct {
Logger genericLogger
level LEVEL
name string
}
func NewLogger(l... |
30d19ff7c2f729f0e7176bc211fab6adc705de5f | a17efb65b916f10fd8e39866b623717fdc4da02d | sukhil-suresh/kpack | /pkg/apis/experimental/v1alpha1/store_validation_test.go | Go | go | 1,648 | permissive | package v1alpha1
import (
"context"
"testing"
"github.com/sclevine/spec"
"github.com/stretchr/testify/assert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis"
)
func TestStoreValidation(t *testing.T) {
spec.Run(t, "Store Validation", testStoreValidation)
}
func testStoreValidation(t *test... |
e205426bf5cad31ce0208674b7ba88cc20801869 | 5838c1d14d05ad449df74489e0d288c0ef849a9f | nabla-containers/gorump | /go1.5/src/runtime/lfstack.go | Go | go | 934 | permissive | // Copyright 2012 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.
// Lock-free stack.
// The following code runs only on g0 stack.
package runtime
import "unsafe"
func lfstackpush(head *uint64, node *lfnode) {
node.pushcnt... |
57962281b136bbaf50924cf84ad06c43c0f7d44f | a1d47dd995790275bb4a98d0c04e46d2d29b43a2 | preguica/RocksDBCRDTDB | /src/rockscrdtdb/opcrdts/set_addwins_test.go | Go | go | 2,311 | permissive | // Copyright 2018 Nuno Preguica, NOVA LINCS, FCT, Universidade NOVA de Lisboa.
// All rights reserved.
// Use of this source code is governed by Apache 2.0
// license that can be found in the LICENSE file.
package opcrdts
import (
"testing"
"github.com/facebookgo/ensure"
"rockscrdtdb/utils"
)
func TestSetAddWins(t... |
b243839206a80c3bc7e77a4936f0432c128a6b08 | fbac34b1612803bc0ad86d74e1aa35a654f25a07 | openshift/ci-tools | /cmd/entrypoint-wrapper/main.go | Go | go | 14,229 | permissive | package main
import (
"context"
"errors"
"flag"
"fmt"
"io"
"io/fs"
"log"
"os"
"os/exec"
"os/signal"
"path"
"path/filepath"
"strings"
"syscall"
"time"
"github.com/sirupsen/logrus"
"gopkg.in/fsnotify.v1"
coreapi "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery... |
d4d2c98db748015f2755651cbe5d5a4462a96c84 | 890474569a15933613a3e0d1a8874dd99051a75e | openshift/compliance-operator | /vendor/github.com/openshift/api/helm/v1beta1/register.go | Go | go | 1,157 | permissive | package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
var (
GroupName = "helm.openshift.io"
GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
schemeBuilder = runtime.NewSchemeBuilder(addKnow... |
a524aca6fca57382a46803d8859f7d0f7da75b7f | a1b2090ca94e97160dc5f0886a743a74ee14a2f2 | inotite/AlgoreaBackend | /app/api/items/navigation_data_mapper.go | Go | go | 9,005 | permissive | package items
import (
"github.com/jinzhu/gorm"
"github.com/France-ioi/AlgoreaBackend/app/database"
"github.com/France-ioi/AlgoreaBackend/app/service"
)
// rawNavigationItem represents one row of a navigation subtree returned from the DB
type rawNavigationItem struct {
// items
ID int64
Type... |
49df9e5428c7ac266931cf4733c238290bdc7e51 | 3a3849ae1915cc25951634efeecdaf00ce8a4714 | vyloy/stellar_go | /handlers/federation/reverse_sql_driver.go | Go | go | 610 | permissive | package federation
import "github.com/quantadex/stellar_go/support/errors"
// LookupReverseRecord implements `ReverseDriver` by performing
// `drv.LookupReverseRecordQuery` against `drv.DB` using the provided parameter
func (drv *ReverseSQLDriver) LookupReverseRecord(
accountid string,
) (*ReverseRecord, error) {
d... |
66224d5b900e5e93ed603509ff65912a553e7922 | e1763b9b647fc29e60e96d1864acbd2d280c2155 | cf-platform-eng/marman | /pivnet/pivnet.go | Go | go | 3,126 | permissive | package pivnet
import (
"errors"
"fmt"
"log"
"os"
"path"
"github.com/pivotal-cf/go-pivnet"
"github.com/pivotal-cf/go-pivnet/logshim"
"code.cloudfoundry.org/lager"
"github.com/Masterminds/semver"
. "github.com/pkg/errors"
)
//go:generate counterfeiter Client
type Client interface {
AcceptEULA(product stri... |
76869e0c9e7b4f0c070b9a3953b16360fc036598 | 1222ddcb93c17e4d18fe75fa9c24fedc873064a9 | Applifier/echo | /echo.go | Go | go | 11,841 | permissive | package echo
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"path"
"reflect"
"runtime"
"strings"
"sync"
"encoding/xml"
"github.com/labstack/echo/engine"
"github.com/labstack/gommon/log"
)
type (
Echo struct {
prefix string
middleware []Middleware
head ... |
dd0c9c609cba2fcbeabc8eaeafbad5b77da993da | 9db7b546aa2e115f5a1f81f82f9384a5f6cd98f5 | zmsoft/vehicle | /src/vehicle/db/db.go | Go | go | 533 | no_license | package db
import (
"vehicle_system/src/vehicle/db/mysql"
"vehicle_system/src/vehicle/db/redis"
"vehicle_system/src/vehicle/logger"
)
func Setup() {
if gormDb,err:= mysql.GetMysqlInstance().InitDataBase();err != nil{
logger.Logger.Error("gorm db connect fail:%+v",gormDb)
logger.Logger.Print("gorm db connect ... |
fab1d6d86c49dd4c847b1728fe55651dbeb0095a | 2ca4a5850f09327ab30ff554759fca4c6aae7bc0 | EricHripko/dipod | /vendor/github.com/moby/buildkit/executor/containerdexecutor/executor.go | Go | go | 5,242 | permissive | package containerdexecutor
import (
"context"
"io"
"os"
"path/filepath"
"strings"
"syscall"
"time"
"github.com/containerd/containerd"
"github.com/containerd/containerd/cio"
containerdoci "github.com/containerd/containerd/oci"
"github.com/containerd/continuity/fs"
"github.com/docker/docker/pkg/idtools"
"g... |
bfc717db5d0fb441429224f0b37d94616260362c | 57acc20b0ce80fdf4c3ec92297b0b97e9a0f5725 | Aakash-Dixit/golang-examples | /ds_algo/sort.go | Go | go | 629 | no_license | package main
import (
"fmt"
"sort"
)
type programmer struct {
Age int
}
type byAge []programmer
func (p byAge) Len() int {
return len(p)
}
func (p byAge) Swap(i, j int) {
p[i], p[j] = p[j], p[i]
}
func (p byAge) Less(i, j int) bool {
return p[i].Age < p[j].Age
}
func main() {
myInts := []int{7, 5, 1, 9, 2... |
95bed258e43380a9da3646046602821ed8eb50ed | a6f77bb3ea55008bb2dc7e1810218406e90bb1bd | Ketouem/immo-scraper | /lib/scraper/leboncoin.go | Go | go | 2,366 | no_license | package scraper
import (
"net/url"
"strconv"
"strings"
"github.com/gocolly/colly"
"github.com/sirupsen/logrus"
)
// SOURCE is used to tag the results
const SOURCE = "leboncoin"
var (
c = colly.NewCollector(colly.Async(true))
)
// SetupLeboncoin is used to perform additional tweak (e.g. colly's Collector)
fun... |
ea1ac5fef14cd35c95d24df8937e057d7dc6db17 | 7cfe1a9d7038156d5fdffe1246c574855218b7e0 | tormoder/fit | /internal/types/fit.go | Go | go | 2,770 | permissive | package types
import "fmt"
type Kind byte
const (
NativeFit Kind = 0x00 // Standard -> Fit base type/alias
TimeUTC Kind = 0x01 // Time UTC -> time.Time
TimeLocal Kind = 0x02 // Time Local -> time.Time with Location
Lat Kind = 0x03 // Latitude -> fit.Latitude
Lng Kind = 0x04 // Longitude -> fi... |
f5f4c519d74e63420cc4e73392d053984698eccb | 1756992672d51eaff6c452e6bcf7cf9e991916a1 | MichaelMonashev/sync | /netmutex/go17plus_test.go | Go | go | 1,347 | permissive | // +build go1.7
package netmutex
import (
"testing"
"time"
)
func BenchmarkMain(mb *testing.B) {
conn, err := Open(10, time.Minute, addresses, nil)
if err != nil {
mb.Fatal(err)
}
defer conn.Close(1, time.Minute)
retries := 10
timeout := time.Minute
ttl := time.Second
key := "a"
mb.Run("Lock",
func... |
512ce892f7d080d792e5f2f238157d96e07cc12c | 592eab5a299990d3e16403eed520cac60d2d29f5 | HewlettPackard/terraform-provider-oneview | /vendor/github.com/HewlettPackard/oneview-golang/ov/logical_switch.go | Go | go | 2,203 | permissive | package ov
import (
"github.com/HewlettPackard/oneview-golang/utils"
)
type LogicalSwitch struct {
Category string `json:"category,omitempty"` // "category": "logcial-switch-groups",
ConstitencyStatus string `json:"constitencyStatus,omitempty"` //"con... |
29c237393c3b76018b0309bab6316d8db4283194 | 444b2e1e852ee16f136b849f8d2fe963b4d34d32 | figoxu/Figo | /cache-sentry_test.go | Go | go | 565 | no_license | package Figo
import (
"github.com/quexer/utee"
"log"
"testing"
)
func TestSentry(t *testing.T) {
tc := utee.NewTimerCache(60, nil)
put := func(key, val interface{}) {
tc.Put(key, val)
}
get := func(key interface{}) interface{} {
return tc.Get(key)
}
cacheObj := NewCacheObj(put, get)
notify := func(key ... |
3440e334627bd7e575d2b26c8c147b84d99c5ff8 | 9f7e067c89e78234187093cb9675050b9e976f40 | JanMa/nomad-driver-nspawn | /vendor/github.com/hashicorp/nomad/client/pluginmanager/csimanager/interface.go | Go | go | 1,687 | permissive | package csimanager
import (
"context"
"strings"
"github.com/hashicorp/nomad/client/pluginmanager"
"github.com/hashicorp/nomad/nomad/structs"
)
type MountInfo struct {
Source string
IsDevice bool
}
type UsageOptions struct {
ReadOnly bool
AttachmentMode structs.CSIVolumeAttachmentMode
AccessMode ... |
7baeaf347b5b09d7525b393a5860044c079e6de0 | 9b82f0ee0753de09bde588cd207cb2c5bcaa2cf2 | gaodengyun/goldencloud-sdk-go | /examples/invoice/model/print.go | Go | go | 457 | no_license | package model
func Print() (routerAddress string, postData map[string]interface{}) {
routerAddress = "/tax-api/invoice/print/v1"
postData = map[string]interface{}{
"seller_taxpayer_num": "500102010004038",
"order_sn": "",
"order_id": "gp_20190828115454_742_11296_31131",
"print_type": ... |
8571cbf728e028ca79c2d9ea08f7a643859516af | 7041d4a87e11cb66c64dcfc5ae4eedb72b2bbe68 | dknlam/vsphere-automation-sdk-go | /services/nsxt/global_infra/segments/ports/PortMonitoringProfileBindingMapsTypes.go | Go | go | 18,572 | permissive | // Copyright © 2019-2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: BSD-2-Clause
// Auto generated code. DO NOT EDIT.
// Data type definitions file for service: PortMonitoringProfileBindingMaps.
// Includes binding types of a structures and enumerations defined in the service.
// Shared by client-s... |
259d4014bff0a4d4c421f1087b1288ff92cd1566 | bff1a1c51b905175e932e99cba4bb1c19df39913 | jdonenine/reaper-operator | /controllers/reaper_controller_test.go | Go | go | 12,628 | permissive | package controllers
import (
"context"
"strconv"
"time"
api "github.com/k8ssandra/reaper-operator/api/v1alpha1"
mlabels "github.com/k8ssandra/reaper-operator/pkg/labels"
"github.com/k8ssandra/reaper-operator/pkg/reconcile"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
appsv1 "k8s.io/api/apps/v1"
cor... |
19bd099e09799416d172666183770e78ec33f167 | ec23f14242023a506972659788a902ce57fa3eb6 | shinigambit/test-infra | /tools/dkcm/clerk/cluster.go | Go | go | 1,469 | permissive | /*
Copyright 2020 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... |
aa345df40b2ab29cc17bc1cfa29bdcec5da02d2c | 9b618343a45c70fe4eb00a0522da8474fe602f1c | Averroes/krkr | /utils.go | Go | go | 796 | no_license | package main
import (
"encoding/hex"
"fmt"
"io/ioutil"
"strings"
)
func decodeHex(hexData string) []byte {
decoded, err := hex.DecodeString(hexData)
if err != nil {
fmt.Println("Decode Hex: %s", err)
}
return decoded
}
func loadWords(filename string) []string {
var words []string
data := readFile(filen... |
8fe7408f82b0dc4bec7c605c72425d0a10f8b9d0 | 8d8df2d5912dbca0555a67b809cde01992be36bb | k2rth1k/qt | /pkg/api/server.go | Go | go | 1,183 | no_license | package api
import (
"github.com/k2rth1k/qt/pkg/config"
"github.com/k2rth1k/qt/pkg/db"
qt "github.com/k2rth1k/qt/pkg/proto"
log2 "github.com/k2rth1k/qt/utilities/log"
"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
"log"
"net"
)
type QuickTradeService struct {
store db.Store
... |
2687140281fe459cce4e773cdb3efd8e46b4e835 | 17a16e010937f7f4189ef577a2f0a5cc868e98c4 | tuxago/go-platform | /router/stats.go | Go | go | 3,217 | permissive | package router
import (
"time"
"github.com/micro/go-micro/errors"
"github.com/micro/go-micro/registry"
router "github.com/micro/go-platform/router/proto"
"github.com/rcrowley/go-metrics"
)
type stats struct {
// the service for these stats
service *registry.Service
// time of stats creation
timestamp int64... |
45955549cd4231b1f5af0bea63c4a21f774291c5 | 1d0dfe633fc3c5fe0f102e9d6a7adf3403a3bf7c | vsukhin/RESTfulAPI | /workflows/header.go | Go | go | 10,024 | no_license | package workflows
import (
"application/config"
"application/helpers"
"application/models"
"application/services"
"errors"
"time"
)
type HeaderWorkflow struct {
OrderRepository services.OrderRepository
FacilityRepository services.FacilityRepository
HeaderFacilityRepository services.HeaderFa... |
367fab299fb45833e500222825494acaeb85f966 | 7b4cdac7f5cc7ca112d80fd01dc75333c0037e11 | test-repo-arcturus/azure-sdk-for-go | /profiles/latest/streamanalytics/mgmt/streamanalytics/models.go | Go | go | 20,288 | permissive | // +build go1.9
// Copyright 2020 Microsoft 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 appl... |
f60ec6d9c8ab186bd42b6e05605121d5875fd44d | dc6d6bff8513094c6e9bd1ddc99abdf8d5129d1b | AlbertTian1987/GoStudy | /hackDida/hackUtil_test.go | Go | go | 1,791 | no_license | package main
import (
"testing"
"time"
"net/http"
"net/http/httptest"
"io/ioutil"
"fmt"
"encoding/json"
)
func TestGetMd5(t *testing.T){
t.Log(GetMd5("dsad123123"))
t.Log(GetMd5("dsad123123"))
}
func TestTimeFormat(t *testing.T){
const layout = "20060102030405"
now := time.... |
6fd70c79f66a3be97aa93f32170bf8e7ed4f0f19 | 09d2b8cbb04b020ff88b78cdcbfedcda6d4df8e3 | silky/i2kit | /cli/providers/aws/cf/watch.go | Go | go | 1,758 | permissive | package cf
import (
"fmt"
"strings"
"time"
logger "log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudformation"
)
//Watch waits for a AWS Cloud Formation stack state
func Watch(name string, consumed int, config *aws.Config, log *logger.Logger... |
682e9b6e938aba494d483e4a9873f50a0c91e7e3 | 065e56d0a593b413aaa265981e6e9fc43ee251d7 | ftlnetwork/ftlnetwork-sdk | /x/stake/genesis_test.go | Go | go | 4,707 | permissive | package stake
import (
"fmt"
"testing"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
sdk "github.com/ftlnetwork/ftlnetwork-sdk/types"
keep "github.com/ftlnetwork/ftlnetwork-sdk/... |
805584c1e33b6881dde69f6c2b06349a0e4729ba | 3cb5656dba8399c9539abc758bf1648a500f5b88 | tytechortz/go-programming | /code_samples/grouping-data/maps/main.go | Go | go | 268 | no_license | package main
import "fmt"
func main() {
m := map[string]int{
"James":32,
"Miss Moneypenny":27,
}
fmt.Println(m)
fmt.Println(m["James"])
v, ok := m["Barnabas"]
fmt.Println(v)
fmt.Println(ok)
if v, ok := m["James"]; ok {
fmt.Println("IF PRINT", v)
}
} |
6b75d522c2b843130817d58fd3cbbd92144ce86c | 0fc40ab7673455d1a2a4ecf99169a416f5a7d417 | Bungysheep/contact-management | /pkg/models/v1/modelbase/modelbase.go | Go | go | 2,559 | permissive | package modelbase
import (
"reflect"
"strconv"
"strings"
"time"
"github.com/bungysheep/contact-management/pkg/common/message"
messagemodel "github.com/bungysheep/contact-management/pkg/models/v1/message"
)
// ModelBase model
type ModelBase struct{}
// NewModelBase creates Model Base
func NewModelBase() *Model... |
df1fab34eeab2483f8f2cf4551d86779708ce749 | 8f0a572d9f4f37cf9fbdf980ddff73aec0b4b518 | beibeiabeibei/roc | /cache.go | Go | go | 1,921 | permissive | package roc
import (
"context"
"time"
"github.com/xiaojiaoyu100/curlew"
)
// Cache is a store.
type Cache struct {
GCInterval time.Duration
BucketNum int
buckets []*Bucket
dispatcher *curlew.Dispatcher
close chan struct{}
}
// New returns a new cache.
func New(setters ...Setter) (*Cache, error) {
... |
0c2eff0c236031f5d300a801d9a0dc9b5afee572 | 7ac68bb1de47da970ce621db42bd0fe425b82abb | sapcc/kubernetes-operators | /openstack-seeder/vendor/k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/core/internalversion/event.go | Go | go | 4,639 | permissive | /*
Copyright 2018 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, ... |
2218149200027ac56332d69ab46d7ef428f9ae9d | 16e018d2f3e47573eadfda5699e16e2bb41578dd | kalafut/pgsqlite | /pgsqlite.go | Go | go | 1,397 | no_license | package pgsqlite
import (
"context"
"database/sql"
"regexp"
)
var paramRe = regexp.MustCompile(`\$\d+`)
var returnRe = regexp.MustCompile(`(?i)\s*RETURNING\s+\w+;?\s*$`)
type MyDriver struct {
*sql.DB
}
func Open(driverName, dataSourceName string) (*MyDriver, error) {
db, err := sql.Open(driverName, dataSource... |
c76986d3ce9a2c7e1a585d66bbf3f0f78dc605db | 56acb2ff6c78cfa348e2ec83e1c1544063c7675f | 89trillion-shenwei/day1 | /util/jsonAnaly.go | Go | go | 1,064 | no_license | package util
import (
"encoding/json"
"fmt"
"github.com/spf13/pflag"
"io/ioutil"
)
type model struct {
Id string `json:"id"` //士兵id
Rarity string //士兵稀有度
CombatPoints string //战力
Cvc string //版本
UnlockArena string //当前解锁阶段
}
// JsonAnaly 通过pflag获取路径
func JsonAnaly() {
path1 := pf... |
78f38a6899014c708d79ba481742ac1bb67360c9 | dc8008f2abcb450c81ade6e48b84a58fc1504552 | debdutdeb/compose-cli | /local/e2e/compose/compose_test.go | Go | go | 4,549 | permissive | /*
Copyright 2020 Docker Compose CLI 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 a... |
ac068b9e9b232961be656376f788ae601b9e849e | 8acb8080151065b1e53d7fd4252c6a7a56ea31bd | chilianyi/openpitrix | /pkg/libconfd/resource_test.go | Go | go | 4,084 | permissive | // Copyright confd. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE-confd file.
// +build ignore
package libconfd
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
"text/template"
)
// createTempDirs is a helper function which creates tem... |
e9cffe0d8410a69617c21361c5b6537c5e796114 | 31de933f43cef8376339cf43d47cf778e02a4396 | OyyoDams/matterbridge | /bridge/rocketchat/rocketchat.go | Go | go | 2,440 | permissive | package brocketchat
import (
"github.com/42wim/matterbridge/bridge"
"github.com/42wim/matterbridge/bridge/config"
"github.com/42wim/matterbridge/bridge/helper"
"github.com/42wim/matterbridge/hook/rockethook"
"github.com/42wim/matterbridge/matterhook"
)
type MMhook struct {
mh *matterhook.Client
rh *rockethook.... |
62592f1b3e66d14dd49aea9e62fda14e986a2948 | d4ada315e9f3562ca2fd323716d90445bd390c4f | jasonewang/ygot | /ygen/protogen.go | Go | go | 55,410 | permissive | // Copyright 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... |
21fa9edf47514933368c9033a9d8d34c8cf077db | 8335ae8ee2ac1902b2e3091f649f7677c7f86122 | donaldww/wavelet | /ledger.go | Go | go | 40,111 | permissive | // Copyright (c) 2019 Perlin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distri... |
de979a6cf4f550077538bc5ff83c2d209751d4f5 | d00246311224a26332dd5db9d572584f1e70207f | inkyblackness/hacked | /ss1/StringError.go | Go | go | 288 | permissive | package ss1
// StringError is a string-based type implementing the error interface.
// It is used to cover all errors based on static strings.
type StringError string
// Error returns the string interpretation of the error.
func (err StringError) Error() string {
return string(err)
}
|
4677a12194e3299982aa136cb7879df832ba3d22 | 1fd496b03e393443f1209f8b4f412c3f24aa68ee | js-ts/ekz | /cmd/ekz/list_cluster.go | Go | go | 2,093 | permissive | package main
import (
"fmt"
"github.com/chanwit/ekz/pkg/constants"
"k8s.io/client-go/tools/clientcmd"
"text/tabwriter"
"github.com/chanwit/script"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/util/sets"
)
var listClusterCmd = &cobra.Command{
Use: "cluster",
Aliases: []strin... |
db7edcaeb1662cfaaaa2eff7bfc393227e381faa | b11eafebb899a1547adc6ee35a3762bd42990853 | dougsland/cri-o | /vendor/github.com/containers/common/pkg/cgroupv2/cgroups_linux.go | Go | go | 539 | permissive | package cgroupv2
import (
"sync"
"syscall"
"golang.org/x/sys/unix"
)
var (
isCgroupV2Once sync.Once
isCgroupV2 bool
isCgroupV2Err error
)
// Enabled returns whether we are running in cgroup 2 cgroup2 mode.
func Enabled() (bool, error) {
isCgroupV2Once.Do(func() {
var st syscall.Statfs_t
if err := sy... |
db55688e1e2870501ee0020fee6468f6779786f2 | 1261e7994e8424cebe4c944e84b418a22d75b5ba | kunalkushwaha/ctr-powertest | /cmd/common.go | Go | go | 1,765 | permissive | package cmd
import (
"context"
"github.com/containerd/containerd/namespaces"
"github.com/kunalkushwaha/ctr-powertest/libruntime"
"github.com/kunalkushwaha/ctr-powertest/testcase"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
var stdContainerdConfig = libruntime.RuntimeConfig{
RuntimeName: "... |
a8408d28ba82a0d324e3f2cf7762ae94e307d27c | 084e0307dec355e63fab48cfec7d2d8c9259f801 | Carmendelope/authx-interceptors | /pkg/interceptor/apikey/inmemoryaccess.go | Go | go | 1,903 | permissive | /*
* Copyright 2019 Nalej
*
* 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... |
2d5d8bd8fd75051b23b889bf02757c6a3247bc13 | d9fb62a2471e45a8941904d5c7602904cfe81226 | scantistdemo007/kube-state-metrics | /internal/store/hpa_test.go | Go | go | 8,196 | permissive | /*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... |
1a13443a369bcf126b5371ce4aebb6affeefff4e | 7ba0f5194fa0af4edcba7c3e6fca4601bde251bd | viveksyngh/arkade | /cmd/apps/openfaas_ingress_app.go | Go | go | 6,634 | permissive | // Copyright (c) arkade author(s) 2020. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package apps
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"github.com/alexellis/arkade/pkg/config"
"github.com/alexelli... |
a603b5a2b7fcaf405e829415ac69452dfb60deaf | e94a0a4bd64542b307d57ded335cacb4bdaad2fd | karan/kubernetes | /pkg/kubelet/dockershim/helpers_windows.go | Go | go | 7,105 | permissive | // +build windows,!dockerless
/*
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 applicabl... |
325116f13bc0c55cb12ee84c353fb50a819f4bc5 | 01d938af423cf56671de7403987f7cbd330be38f | geekvikas/data_structure_and_algorithms | /chapter5/doubleLink/linklist.go | Go | go | 2,467 | no_license | package doubleLink
import (
"fmt"
"log"
)
type DoubleLinker interface {
String() string
ReversePrint() string
InsertFront(data interface{})
InsertIndex(index int , data interface{})
Add(data interface{})
Update(index int,data interface{})
Delete(index int)
GetSize() int
IsEmpty() bool
}
type DoubleLinkLi... |
11736956332cb1a0a337eff532e5e7e5ac64c6e2 | 645684dd42d6c62f79b1c580c3b72784d879b40f | kidonchu/fzf | /src/result_test.go | Go | go | 4,101 | permissive | package fzf
import (
"math"
"sort"
"testing"
"github.com/junegunn/fzf/src/curses"
"github.com/junegunn/fzf/src/util"
)
func TestOffsetSort(t *testing.T) {
offsets := []Offset{
Offset{3, 5}, Offset{2, 7},
Offset{1, 3}, Offset{2, 9}}
sort.Sort(ByOrder(offsets))
if offsets[0][0] != 1 || offsets[0][1] != 3 ... |
b60a88c1f8f591a40129331b931c7e5b39113053 | fc6522c9e47af337b84a40615f5a71214f70ff04 | rosaguvi/CapacitacionGo | /capacitacion_Go/servidores/ejercicio_Libreria/models/libros.go | Go | go | 262 | no_license | package models
import (
// paquetes Externos
"gorm.io/gorm"
)
type Libro struct {
gorm.Model
Titulo string
Descripcion string
Genero string
Autor string
Editorial string
A_publicacion int
NumCopVendiadas int
}
|
80cc2a7f93ede019c3ac521cfef6a17158f40c20 | 6939a6dc335edf825626798cdad3076abb7ac80a | hayajo/http-server | /main.go | Go | go | 380 | no_license | package main
import (
"flag"
"fmt"
"log"
"net/http"
)
func main() {
var (
address = flag.String("a", "0.0.0.0", "address")
port = flag.Int("p", 8080, "port")
)
flag.Parse()
listen := fmt.Sprintf("%s:%d", *address, *port)
root := flag.Arg(0)
log.Printf("Listening at http://%s", listen)
log.Fatal(http... |
e9fad09e01be100edca8593c0baf40f4c78bc98d | 4373f5860b5a788849ca85599a3b19c5d5dad2d4 | lupinthe14th/leetcode | /explore/other/card/november-leetcoding-challenge/week-1/minimumcosttomovechipstothesameposition/solution_test.go | Go | go | 629 | permissive | package minimumcosttomovechipstothesameposition
import (
"fmt"
"testing"
)
func TestMinCostToMoveChips(t *testing.T) {
t.Parallel()
type in struct {
position, m []int
}
tests := []struct {
in in
want int
}{
{in: in{position: []int{1, 2, 3}}, want: 1},
{in: in{position: []int{2, 2, 2, 3, 3}}, want: ... |
cd48dd6343c089205cbb130693466ce1073ea79e | 0b9973b0fa56f5e4c3515b548d084f1be5262f46 | codeready-toolchain/toolchain-e2e | /testsupport/proxyplugin.go | Go | go | 1,329 | no_license | package testsupport
import (
toolchainv1alpha1 "github.com/codeready-toolchain/api/api/v1alpha1"
"github.com/codeready-toolchain/toolchain-e2e/testsupport/wait"
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"testing"
)
func VerifyProxyPlugin(t *testing.T, hostAwait *wait.Hos... |
42523ae5618990e88f3a76474e73815b2cffc96a | 57b37cbf51f8ba10c0b51d119a106bf9ad131908 | gaohuag/learn-golang | /basic/atomic/atomic.go | Go | go | 529 | no_license | // atomic Increment and Get
package main
import (
"fmt"
"sync"
"time"
)
// 定义结构
type AtomicInt struct {
value int
lock sync.Mutex
}
// 增加
func (a *AtomicInt) Increment() {
fmt.Println("safe Increment")
func() {
a.lock.Lock()
defer a.lock.Unlock()
a.value++
}()
}
// 获取
func (a *AtomicInt) Get() int {... |
eb96b62fde7abda773a9c958c8d3bd7ce2722c54 | e913b0f0296020358cf864e0c24cab3701c7a942 | muyadan/rest-layer | /rest/method_item_patch.go | Go | go | 2,478 | permissive | package rest
import (
"context"
"net/http"
"github.com/rs/rest-layer/resource"
)
// itemPatch handles PATCH resquests on an item URL
//
// Reference: http://tools.ietf.org/html/rfc5789
func itemPatch(ctx context.Context, r *http.Request, route *RouteMatch) (status int, headers http.Header, body interface{}) {
va... |
f159fcf26ace3d73f9f7686ff2a5b73fac33c5ed | bdc20aba35f3f958b4dbefc2e128682d3897b52e | rchamorro/pulumi-azure-nextgen | /sdk/go/azure/automation/latest/jobSchedule.go | Go | go | 6,877 | 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 latest
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Definition of the job schedule.
// Lates... |
f2a44fcf2d3fd30796853d3ee36f4dba589132ea | b072788b35ebe683ff1ccd5c080ddb7c71f6c4b8 | m90/go-chatbase | /api.go | Go | go | 3,121 | permissive | package chatbase
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"time"
)
var (
client = http.Client{}
)
// SetAPITransport allows setting a transport for the http.Client that is being used
// for handling Chatbase API calls
func SetAPITransport(t http.RoundTripper) {
client.Transport = t
}... |
0a3b96486742cae06e091cb84490db5d325fe54f | bae5952d8f0b82e07d68cbaa1eb37418dcada243 | laher/chirpstack-application-server | /internal/storage/gateway_test.go | Go | go | 9,089 | permissive | package storage
import (
"context"
"database/sql"
"testing"
"time"
"github.com/lib/pq/hstore"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
"github.com/brocaar/chirpstack-application-server/internal/backend/networkserver"
"github.com/brocaar/chirpstack-application-server/internal/backend/net... |
375313e27307d1e34ac1684eb7d8ccc9e9cd2464 | 591cc3b075f69ddbda3e19d0c773a6740940a336 | zachwangfsqm/tidb-operator | /pkg/controller/restore_status_updater.go | Go | go | 4,646 | permissive | // Copyright 2019 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
d3e73978d190f01122a6969ff33f2dc806fe29f2 | de04791d15a61f3bf6a119178354b9373c49ff69 | tgraf/google-api-go-client | /adexchangebuyer/v1.3/adexchangebuyer-gen.go | Go | go | 161,890 | permissive | // Copyright 2020 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package adexchangebuyer provides access to the Ad Exchange Buyer API.
//
// For product documentation, see: https://developers.google.com/ad-exc... |
e6ff688a1d3e0d9e8fd681a449a615a400c41ae4 | bb421f94cac94c67237da2919994ef669b18b798 | myafeier/ws | /main.go | Go | go | 1,729 | no_license | package main
import (
"encoding/json"
"flag"
"github.com/myafeier/ws/lib"
"log"
"net/http"
"os"
"path/filepath"
"text/template"
// "time"
)
var (
addr = flag.String("addr", ":8080", "http service address")
// redisaddr = flag.String("redis", "127.0.0.1:6379", "redis service address")
assets = flag.Stri... |
26ec6cb2324be04469e808bd93cf7a41741e8b81 | 44ae3e3d65094623c286f1fe6b4f1ce48c081f32 | Stanislav1975/sourcegraph | /cmd/frontend/internal/pkg/handlerutil/handler.go | Go | go | 3,054 | permissive | package handlerutil
import (
"context"
"fmt"
"io"
"net/http"
"os"
"runtime"
"sync"
"gopkg.in/inconshreveable/log15.v2"
"github.com/gorilla/schema"
"github.com/pkg/errors"
"github.com/neelance/parallel"
"github.com/sourcegraph/sourcegraph/internal/errcode"
)
var (
schemaDecoder = schema.NewDecoder()
... |
9fb9617ea4b746138ce7dafb645d85c397605470 | 67db52efa5799b435d4677bf63fd0af451f8ca48 | tmshn/argo-events | /gateways/server/hdfs/client.go | Go | go | 4,781 | permissive | package hdfs
import (
"fmt"
"github.com/argoproj/argo-events/pkg/apis/eventsource/v1alpha1"
"github.com/colinmarc/hdfs"
krb "gopkg.in/jcmturner/gokrb5.v5/client"
"gopkg.in/jcmturner/gokrb5.v5/config"
"gopkg.in/jcmturner/gokrb5.v5/credentials"
"gopkg.in/jcmturner/gokrb5.v5/keytab"
corev1 "k8s.io/api/core/v1"
... |
363e6d4a62985010717403132c0846714f5edaa2 | 30aaf3cad99b9da3cb9dce40f18a8fc6b2d1c3d6 | rueyxian/go-gist | /topic/concurrency/01-goroutines/05-goroutine-id/main.go | Go | go | 515 | no_license | package main
import (
"bytes"
"fmt"
"runtime"
"strconv"
"time"
)
// source:
// https://blog.sgmansfield.com/2015/12/goroutine-ids/
func main() {
fmt.Println(goid())
go justAFunc()
go justAFunc()
go justAFunc()
time.Sleep(1 * time.Second)
}
func justAFunc() {
fmt.Println(goid())
}
func goid() uint64 {... |
05412587d2be01cfd28645e39ee65c92175c55de | 2ca0574256de1bc1cb21a576a2597fb47f915d1a | violetzijing/design-pattern-in-go | /adapter.go | Go | go | 1,008 | no_license | package main
import "fmt"
type MediaPlayer interface {
Play(string, string)
}
type AdvancedPlayer interface {
PlayVlc(string)
PlayMP4(string)
}
type VlcPlayer struct{}
type MP4Player struct{}
func (*VlcPlayer) PlayVlc(filename string) {
fmt.Println("play vlc: ", filename)
}
func (*VlcPlayer) PlayMP4(filename ... |
783388053248d0f22c14b3aed6ef13226c204622 | db93d9808aecc615759c2120ae3e2fc165a4be60 | BugFreeSoftware/wasp | /packages/vm/core/blob/internal.go | Go | go | 3,699 | permissive | package blob
import (
"fmt"
"github.com/iotaledger/wasp/packages/hashing"
"github.com/iotaledger/wasp/packages/kv"
"github.com/iotaledger/wasp/packages/kv/codec"
"github.com/iotaledger/wasp/packages/kv/collections"
"github.com/iotaledger/wasp/packages/kv/dict"
"github.com/iotaledger/wasp/packages/util"
"githu... |
10be3b35671a30b1120f8f639425042a5cdf8c0e | 1e36c7cb78a36b31a3088b4c1801b9aefad571b3 | ratakefumi/dapr-bet | /cmd/bets/impl/impl.go | Go | go | 9,687 | no_license | package impl
import (
"context"
"encoding/json"
"fmt"
"log"
"os"
"time"
"github.com/cbellee/dapr-bet/cmd/bets/spec"
"github.com/cbellee/dapr-bet/pkg/helper"
dapr "github.com/dapr/go-sdk/client"
"github.com/dapr/go-sdk/service/common"
daprd "github.com/dapr/go-sdk/service/http"
"github.com/g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.