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 |
|---|---|---|---|---|---|---|---|---|
a342a38dbf6fc14de8e98bbd98b6493b6285adb3 | d9086c9385c81d27f99f915ec71afdbb5863344b | elserhumano/contour | /test/e2e/gateway/005_request_header_modifier_test.go | Go | go | 7,999 | permissive | // Copyright Project Contour 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... |
1fe920fe438e98470012e26e3e33931534072648 | 7cd648a6d0e4c5f5e0013d3a8be69cab25ae6783 | Kanokorn/codemania-111 | /goroutines-with-waitgroup.go | Go | go | 393 | no_license | // +build ignore
package main
import (
"fmt"
"io/ioutil"
"log"
"strings"
"sync"
)
func main() {
var wg sync.WaitGroup // HL
wg.Add(1) // HL
go func() {
defer wg.Done() // HL
b, err := ioutil.ReadFile("testdata/a.txt")
if err != nil {
log.Fatal(err)
}
words := strings.Fields(string(b))
for _,... |
a2f27446b76fb93fc95614bc0fe253d9dbd4a447 | 60d31ad5b22c6e58e0d4bb5ec53a80399d651c60 | vipally/cmdline | /cmdline_test.go | Go | go | 3,577 | permissive | // CopyRight 2016 @Ally Dale. All rights reserved.
// Author : Ally Dale(vipally@gmail.com)
// Blog : http://blog.csdn.net/vipally
// Site : https://github.com/vipally
package cmdline_test
import (
"strings"
"testing"
"github.com/vipally/cmdline"
)
func TestGetUsage(t *testing.T) {
var sCheck = `Usage of... |
2b80785ba8f7f8f54ede72438c998f7d2fb49235 | 6188a1feb8b8df26b960377e12604d8d77cdb5e6 | dockercore/fabric | /protos/utils/proputils.go | Go | go | 18,161 | permissive | /*
Copyright IBM Corp. 2016 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 agreed to in wri... |
e54a4a59525145797d15aa052e11d2e408ae9d1f | d61efb9eb86f558d788a1691ae6c58883aa75f3f | male110/GoMvc | /src/Controllers/Home.go | Go | go | 1,904 | no_license | package Controllers
import (
"Model"
"System/Web"
"fmt"
)
type Home struct {
Web.Controller
}
//注册Controller
func init() {
Web.App.RegisterController(Home{})
}
func (this *Home) OnLoad() {
//如果在OnLoad里调用了Response.Write需选设置Content-Type头,设置文档类型
//this.Response.Header().Add("Content-Type", "tex... |
0fe240b3714e782b2f2cbe1b6a323d56c6e74693 | b364f0da576dc6bfb0c9f015427b93216c2851f7 | enriquebris/json2confd | /util_test.go | Go | go | 2,485 | no_license | package main
import (
"encoding/json"
"fmt"
"testing"
)
import . "gopkg.in/check.v1"
// Hook up gocheck into the "go test" runner.
func Test(t *testing.T) { TestingT(t) }
var _ = Suite(&TestUtilSuite{})
type TestUtilSuite struct {
json1 string
map1 map[string]interface{}
json2 string
map2 map[string]inter... |
af681f7a4de45a560f11ad264d15b6d1b1e30d82 | 13cdf20a801d61a81bb6c86cbba3da39b243e05b | JeffreyBool/Play-with-Data-Structures | /05-recursion/01-linked-list-problems-in-leetcode/solution2/solution2.go | Go | go | 622 | no_license | /**
* Author: JeffreyBool
* Date: 2019/4/25
* Time: 21:41
* Software: GoLand
*/
package solution2
import (
"Play-with-Data-Structures/05-recursion/01-linked-list-problems-in-leetcode/listnode"
)
/// Leetcode 203. Remove Linked List Elements
/// https://leetcode.com/problems/remove-linked-list-elements/descr... |
1f8e3c5d51d54ffbbb89286a2eb7b64efacb4fde | 5ed09e543ea65107a88ab062cb123a808436bc29 | jonataa/tsuru | /api/server.go | Go | go | 14,840 | 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 (
"fmt"
"net"
"net/http"
"sync"
"time"
"github.com/codegangsta/negroni"
"github.com/tsuru/config"
"github.com/tsuru/tsuru/api/shutdo... |
9be9a797e2f8601970ed0205bef3e5a4671381f8 | 91b3d98dfa03eec42bab48b0f7d31a84a406e98f | pgu/devFestSite-2015 | /devfest.go | Go | go | 3,047 | no_license | package devfest
import (
"fmt"
"net/http"
"net/url"
"encoding/json"
"appengine"
"appengine/datastore"
"appengine/memcache"
)
type User struct {
Favs []string `json:"favs"`
Login string `json:"login"`
}
func init() {
http.HandleFunc("/api/v1/stars/get", getStars)
http.Handl... |
f75013a4b624d74a4e1ab16152289f4620a32cdc | ae502872b740b743996867e9676d430c12025e21 | zanjs/tsuru | /provision/kubernetes/node.go | Go | go | 2,025 | permissive | // Copyright 2016 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 kubernetes
import (
"strings"
"github.com/tsuru/tsuru/provision"
"k8s.io/client-go/pkg/api/v1"
)
type kubernetesNodeWrapper struct {
node *v1.N... |
bd1f9965eaa329aca2d2172804d16924ebb9e7da | 802453fe546c1e6208226a556cb96e7b300599fa | cucxabong/golibby | /trie/trie.go | Go | go | 776 | permissive | package trie
import (
"sync"
)
// Trie holds the trie's root node
type Trie struct {
lock sync.RWMutex
root *node
}
// Upsert assigns arbitrary data to a node in a trie identified by a path of
// keys
func (t *Trie) Upsert(path []string, value interface{}) {
t.lock.Lock()
defer t.lock.Unlock()
if t.root == nil... |
48af71a8a575de3e95ce61dba392e9f98ad7d9b2 | 5662e4430e5cdb19b913eb69f6b8ca905b7df29c | Nepomuceno/msgraph | /src/api_me_calendar_calendar_view_multi_value_legacy_extended_property.go | Go | go | 19,415 | no_license | /*
* OData Service for namespace microsoft.graph
*
* This OData service is located at https://graph.microsoft.com/v1.0/
*
* API version: 1.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package msgraph
import (
_context "context"
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "n... |
94c0ef50242044324eddf4cdf1fe353343a59232 | e127a3e2e2b91a1c4babb0deed0d061fe6d3d2fe | ManchersterByTheSea/openBilibili | /go-common/app/interface/main/tv/dao/cms/dao_test.go | Go | go | 2,772 | no_license | package cms
import (
"context"
"encoding/json"
"flag"
"fmt"
"os"
"testing"
"go-common/app/interface/main/tv/conf"
"go-common/library/database/sql"
. "github.com/smartystreets/goconvey/convey"
)
var (
d *Dao
ctx = context.TODO()
)
const (
_pickSids = 1
_pickEpids = 2
_pickAids = 3
_pickCids = 4
... |
6bf15b0644d253d4064ad5f7547938dbb9a549b0 | 458979aff2dba188b98ed309961374dc8981ee34 | balazsprehoda/blockchain-analyzer-intermediary | /agent/fabricbeat/vendor/github.com/hyperledger/fabric-sdk-go/pkg/fab/events/deliverclient/dispatcher/dispatcher.go | Go | go | 4,250 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package dispatcher
import (
"github.com/hyperledger/fabric-sdk-go/pkg/common/logging"
"github.com/hyperledger/fabric-sdk-go/pkg/common/options"
fabcontext "github.com/hyperledger/fabric-sdk-go/pkg/common/providers... |
66eb5061f12ce77d63ae14823873ddd028057820 | bcc21e4c33efa257b6de03426ba6ba4544f4e5bd | wzhliang/crddemo | /pkg/client/clientset/versioned/typed/wse/v1/fake/fake_wse_client.go | Go | go | 1,089 | permissive | /*
Copyright 2018 The Openshift Evangelists
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... |
a1494e86623512660bfc50b54a7dc05360444d1e | 85ddd25f2f50a74699c9256b3e22cdd00053f681 | butik/di-example | /main_test.go | Go | go | 1,035 | no_license | package main
import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"testing"
)
var _ SearchService = &mockSearchService{}
type mockSearchService struct {
mock.Mock
}
func (m *mockSearchService) SearchProductIDs() []int {
args := m.Called()
retu... |
86f545afc705fc23438ba4373182d4821c501340 | cf289ac56ead7f8324f630523ce47073b62d6ea8 | annProg/learn | /leetcode/0387.first-unique-character-in-a-string/main.go | Go | go | 509 | no_license | package main
import "fmt"
func firstUniqChar(s string) int {
m := map[byte]int{}
min := -1
for i := 0; i < len(s); i++ {
m[s[i]] += 1
}
for i := 0; i < len(s); i++ {
if m[s[i]] == 1 {
return i
}
}
return min
}
func firstUniqChar2(s string) int {
cnt := [26]int{}
for _, ch := range s {
cnt[ch-'a'... |
5f7d366b8311f283f2d91ee0139a590b188d8c76 | df73a1866c251e75c3342b86342342e14354384c | iverson3/studygolang | /docker/xdocker/command/stop.go | Go | go | 1,817 | no_license | package command
import (
"encoding/json"
"fmt"
"io/ioutil"
"strconv"
"studygolang/docker/xdocker/model"
"studygolang/docker/xdocker/network"
"studygolang/docker/xdocker/util"
"syscall"
)
// StopContainer 停止一个运行中的容器
func StopContainer(container string) error {
exists, containerName, err := util.ContainerIsExi... |
285977cd3547f8e63bb984a92634dcef3e106dfb | 12d5d0f199e3ab29b0268f81b09aa158b58548fd | coferjacky/goDemo | /basic/06_LoopDemo.go | Go | go | 2,938 | no_license | package main
import (
"fmt"
)
func main() {
i := 0 //i放在这里就能再for循环外面使用了
for ; i <= 10; i++ { //此处省略初始语句
fmt.Printf("%d\n", i)
}
fmt.Printf("%d", i)
j := 0
for ; ; j++ { //条件语句被省略以后 就是无限循环了
if j > 20 {
break
}
fmt.Printf("新值为%d", j)
}
var k int
for { //全部都省了 无限循环了,里面一定要有 结束语句 否则就是死... |
0fbe83eb47e67be36174c8d6ca914be1701264f3 | 008e2537c38a9ab430a30857a0fbc73347d8d19d | dangersalad/go-itbit | /market_test.go | Go | go | 1,252 | no_license | package itbit
import "testing"
func TestGetTicker(t *testing.T) {
conf := &Config{}
if _, err := GetTicker(conf, SymbolXBTUSD); err != nil {
t.Fail()
return
}
}
func TestGetOrderBook(t *testing.T) {
conf := &Config{}
if _, err := GetOrderBook(conf, SymbolXBTUSD); err != nil {
t.Fail()
return
}
}
func ... |
a17785698f770d4fe5aa55a8c9289be0a136ddf2 | a820e0777e63294c687a539161dcadaf1e140c1b | gdeepesh/google-api-go-client | /bigqueryreservation/v1alpha2/bigqueryreservation-gen.go | Go | go | 118,331 | 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 bigqueryreservation provides access to the BigQuery Reservation API.
//
// For product documentation, see: https://cloud.google.com/bigq... |
5cf2b6500f34f3d7c483e5f8e3a2d951a157f4d3 | 73ce8b14e8cb3be284120aeda8079108eff88ad2 | fox-one/msgpack | /encode_slice.go | Go | go | 2,621 | permissive | package msgpack
import (
"reflect"
"github.com/fox-one/msgpack/codes"
)
var sliceStringType = reflect.TypeOf(([]string)(nil))
func encodeStringValue(e *Encoder, v reflect.Value) error {
return e.EncodeString(v.String())
}
func encodeByteSliceValue(e *Encoder, v reflect.Value) error {
return e.EncodeBytes(v.Byt... |
50a6beb830228aa613834c371eeff5169b60fd24 | 7add532862cfd8e28255389f4c470e166ed74693 | cloud-ca/gocca | /services/cloudca/network.go | Go | go | 4,383 | permissive | package cloudca
import (
"encoding/json"
"github.com/cloud-ca/gocca/api"
"github.com/cloud-ca/gocca/services"
)
type Service struct {
Name string `json:"name,omitempty"`
Capabilities map[string]interface{} `json:"capabilities,omitempty"`
}
type Network struct {
Id string... |
77d19b00399fdd1fb9ee96b29c4e537de1bd9c31 | 8448e581b1d4503bbd83ee11c9d06dca6f2d264f | alabianca/rapi-api | /controllers/api.go | Go | go | 878 | no_license | package controllers
import (
"github.com/alabianca/rapi-api/models"
)
type API struct {
DAL models.DAL
}
type DefaultDAL struct{}
func (d DefaultDAL) Keys() models.APIKeyDAL {
return models.APIKeySource{}
}
func (d DefaultDAL) Education() models.EducationDAL {
return models.EducationSource{}
}
func (d Default... |
462e439b73caef2b58a8e930f12880734c8fdd14 | 725ae140d96cecfcb6860c6380808cd3656669fe | vors/fx | /core/config/value.go | Go | go | 12,230 | permissive | // Copyright (c) 2016 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 Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
ddcb7ec822f5a61f54e3a6bacc1a77dd95881c18 | eb46d2b6f118759d0e08f480c04ba7c3b9647b5f | mnjstwins/kocho | /cli/destroy.go | Go | go | 2,015 | permissive | package cli
import (
"bufio"
"fmt"
"os"
"github.com/giantswarm/kocho/dns"
"github.com/giantswarm/kocho/provider"
"github.com/giantswarm/kocho/swarm"
)
var (
cmdDestroy = &Command{
Name: "destroy",
Description: "Destroy a swarm",
Summary: "Destroy a swarm on AWS",
Run: runDestroy,
}... |
2daf1d5ed66a9dcda70fd89f65ae25e1a499bb2a | b5d09abc0b4b9915e64e9cec00a097e86e048447 | Ferdov/journey | /structure/methods/blog.go | Go | go | 711 | permissive | package methods
import (
"github.com/kabukky/journey/configuration"
"github.com/kabukky/journey/database"
"github.com/kabukky/journey/structure"
"time"
)
var assetPath = []byte("/assets/")
func UpdateBlog(b *structure.Blog, userId int64) error {
err := database.UpdateSettings(b.Title, b.Description, b.Logo, b.C... |
7e58804f1d1b76a05e384c49e2f331e726b2acbf | c54d62fe6593c41737f83b179946460873f569ee | vietanhle97/go-leetcode | /Shortest_Path_With_Alternating_Colors_1129/solution_test.go | Go | go | 1,384 | no_license | package Shortest_Path_With_Alternating_Colors_1129
import (
"github.com/stretchr/testify/assert"
"testing"
)
func Test_shortestPathDifferentColor(t *testing.T) {
type args struct {
n int
red_edges [][]int
blue_edges [][]int
}
tests := []struct {
name string
args args
want []int
}{
{
n... |
39e13cf87fa9f2881c1287f6c9663f49a6b0124f | 77f5c098ff17e8dddbd6cda8224c002499c0d72c | mikeshimura/dbflute-mysql-example | /src/github.com/mikeshimura/dbflute/df/util.go | Go | go | 3,503 | no_license | /*
* Copyright 2014-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... |
6e2860fb5fda2a478de6659372b57434cac33aa6 | 67a9e33c4626a96bf0250c9f38e1ec4a648b067a | rickb777/golist | /internal/set/test/num1_set.go | Go | go | 16,126 | permissive | // Generated by: setup
// TypeWriter: Set
// Directive: +test on Num1
package main
import (
"bytes"
"fmt"
)
//-------------------------------------------------------------------------------------------------
// Num1Collection is an interface for collections of type Num1, including sets, lists and options (where p... |
e2e1fe16831196c849b5e35cbf0c4cebd892a0dc | ca549217e273947dc0fddcb0621ac5a55448c46b | denghongcai/mesh-agent | /provider/rpc/handler.go | Go | go | 902 | no_license | package rpc
import (
"net"
"sync"
"io"
"log"
"fmt"
)
type Handler struct {
clientConn *net.TCPConn
servicePort int
}
func NewRpcHandler(servicePort int) *Handler {
return &Handler{servicePort:servicePort}
}
// naive
func (r *Handler) HandleConn(conn net.Conn) {
r.dialToServer()
tcpConn := conn.(*net.TCPC... |
86d10ecee3a167c3ceab331897303e0f83f75d4c | 38876f2035cb80d3b77a73e80f4a2a7720dc92cc | ishanrai05/anax | /cli/cliutils/cliutils.go | Go | go | 63,462 | permissive | package cliutils
import (
"bufio"
"bytes"
"crypto/tls"
"crypto/x509"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
dockerclient "github.com/fsouza/go-dockerclient"
"github.com/open-horizon/anax/config"
"github.com/open-horizon/anax/cutil"
"github.com/open-horizon/anax/exchange"
"github.com/open-horizon... |
a87e0096b45ede9f767a049da5b38d79c565b3e6 | e1d512c59cf8a268e55dff3d948036ef1a0d9272 | anzhihe/learning | /golang/practice/go-crontab/gopath/src/github.com/owenliang/prepare/mongodb_usage/demo3/main.go | Go | go | 2,029 | no_license | package main
import (
"github.com/mongodb/mongo-go-driver/mongo"
"context"
"github.com/mongodb/mongo-go-driver/mongo/clientopt"
"time"
"fmt"
"github.com/mongodb/mongo-go-driver/bson/objectid"
)
// 任务的执行时间点
type TimePoint struct {
StartTime int64 `bson:"startTime"`
EndTime int64 `bson:"endTime"`
}
// 一条日志
typ... |
caea3752c4d1f1252631606b54d73ffbb001d92f | 5b04ae1f9a4037506d756667dfc3053ccd42e511 | redsnapper2006/leetcode-cn | /W/324-wiggle-sort-ii/main.go | Go | go | 1,227 | no_license | package main
func quickSelect(nums []int, k, start, end int) int {
pivot := nums[start]
left, right := start+1, end
for left <= right {
for left <= right && nums[left] < pivot {
left++
}
for left <= right && nums[right] >= pivot {
right--
}
if left <= right {
nums[left], nums[right] = nums[righ... |
8f5203a68c60de8519bb4a73a0df2c4c0b7a0031 | 94d2f7501a87bb275cc0df5ff63eddb22de02171 | BenjaminSchiborr/pulumi-terraform-bridge | /pkg/tfshim/sdk-v2/instance_diff.go | Go | go | 3,093 | permissive | package sdkv2
import (
"strings"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim"
)
var _ = shim.InstanceDiff(v2InstanceDiff{})
func resourceAttrDiffToShim(d *terraform.ResourceAtt... |
8fff1c05d9a144b57c296b30396e7d892f21957b | c3254ee2f9b39ee2f1366a5db64e02d09cdf914b | bugken/KenGinWeb | /bluebell/models/community.go | Go | go | 426 | no_license | package models
import "time"
type (
Community struct {
ID int64 `json:"id" db:"community_id"`
Name string `json:"name" db:"community_name"`
}
CommunityDetail struct {
ID int64 `json:"id" db:"community_id"`
Name string `json:"name" db:"community_name"`
Introduction string `j... |
a0a3b1fc681fc275029ceb1f841eb10ea49b93d0 | 305be2b68cd624f56b562f5c3656d834cd4f4a7f | taoluwork/UNetwork-1 | /core/transaction/payload/RegisterUser.go | Go | go | 1,272 | permissive | package payload
import (
"io"
. "UNetwork/common"
"UNetwork/common/serialization"
)
const RegUserPrefix = "RegUserPrefix"
type RegisterUser struct {
UserName string
UserProgramHash Uint160
Reputation Fixed64
Extension string
}
func (p *RegisterUser) Data(version byte) []byte {
return []byte{0}
... |
c62f773fa88d4772b09019d37e15ecdf9c9f1c15 | df9c66c432160bebd995e4503379f2dc149292b1 | Knight-7/leetcode-go | /datastruct/array/ReverseArrayMin.go | Go | go | 906 | no_license | //Author : knight
//Date : 2020/07/09 09:48:08
//Version : 1.0
//Email : knight2347@163.com
//idea : 旋转数组(原数组是递增的)的最小值
package array
//ReverseArrayMin 旋转数组(原数组是递增的)的最小值
func ReverseArrayMin(numbers []int, length int) int {
if numbers == nil || length <= 0 {
return 0
}
if numbers[0] ... |
14f065203ffe8997669c80fc3e82a2711a4346d9 | 44c59675b9a00a3592ca6641aae9a91f2bb4d7d1 | soellman/kube-aws | /core/controlplane/config/tls_config.go | Go | go | 13,377 | permissive | package config
import (
"crypto/rsa"
"crypto/x509"
"fmt"
"net"
"time"
"io/ioutil"
"path/filepath"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/kms"
"github.com/kubernetes-incubator/kube-aws/gzipcompressor"
"github.com/kubernetes-incubator/kube... |
335eaba08190426af5a231acaca20ef7136afeab | ba897327ef65291002592a36f3d7bfc52c363de3 | guillaumerose/wiki | /server/server.go | Go | go | 1,579 | permissive | package server
import (
"html/template"
"log"
"net/http"
"strings"
"github.com/russross/blackfriday"
)
// Server is the wiki server
type Server struct {
basePath string
logger *log.Logger
}
// New creates a new wiki server
func New(logger *log.Logger, basePath string) *Server {
return &Server{logger: logg... |
1f6ec6b9b9f4166432c7338d996cd2fb17e1e5d6 | f2731da62383bf9789a97af2f2c35d3a7da21459 | priithaamer/paevapraed | /Server/server.go | Go | go | 5,753 | no_license | package main
import (
"encoding/json"
"github.com/gorilla/mux"
"net/http"
"time"
// "bytes"
"database/sql"
"flag"
"fmt"
_ "github.com/go-sql-driver/mysql"
"gopkg.in/gorp.v1"
"log"
"os"
)
var db *sql.DB
var dbmap *gorp.DbMap
type City struct {
Id int
Name string
Code string
Cou... |
8da8dca9bf365d6e01c136b8883b20a8660e718d | b336e00a4763f192f734f85c7cdbc40f56c4c718 | abchain/fabric | /core/sync/sync_block.go | Go | go | 15,186 | permissive | package sync
import (
"bytes"
"fmt"
"github.com/abchain/fabric/core/ledger"
pb "github.com/abchain/fabric/protos"
"sync"
)
type blockSyncHandler struct {
*sessionRT
ledgerSN *ledger.LedgerSnapshot
}
func newBlockSyncHandler(requiredH uint64, root *syncHandler) (*blockSyncHandler, error) {
if requiredH >= ro... |
2b22576318c0bdc47d8a7bc980b5733172fbe69c | a351a7f7342d50356c26a06b8d61720df4c03d00 | erikh/duct | /build.go | Go | go | 1,007 | permissive | package duct
import (
"context"
"log"
"os"
dc "github.com/fsouza/go-dockerclient"
)
// Build is a set of instructions for building a container image. All paths are
// relative to the working directory of the test.
type Build struct {
// Dockerfile is the path to the dockerfile.
Dockerfile string
// Context is... |
6b5f5fbe40be835e1a9a16f989aa12b931a684eb | c0972f971fb8908dc769e5b359b924718bcb7c2a | arangodb/kube-arangodb | /pkg/deployment/resources/inspector/endpoints.go | Go | go | 4,628 | permissive | //
// DISCLAIMER
//
// Copyright 2016-2022 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... |
2db9668cdf27fbc849cceabc532db5604218afcd | 7f81dfa88f2bf75a04066c62ac26db77893ecc40 | mvladev/kubernikus | /pkg/controller/config/config.go | Go | go | 1,667 | permissive | package config
import (
"sync"
kubernetes_informers "k8s.io/client-go/informers"
kubernetes_clientset "k8s.io/client-go/kubernetes"
"k8s.io/helm/pkg/helm"
kube "github.com/sapcc/kubernikus/pkg/client/kubernetes"
"github.com/sapcc/kubernikus/pkg/client/openstack"
"github.com/sapcc/kubernikus/pkg/client/opensta... |
b6a22bab2f4867edeb5788d2ba85cb05aed92db9 | d82d81f8f62642287653b8adb6e376785b136e8f | tscolari/tracer | /tracers/writer/tracer_test.go | Go | go | 1,329 | no_license | package writer_test
import (
"strconv"
"strings"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/tscolari/tracer/tracers/writer"
)
var _ = Describe("Writer", func() {
var (
tracer *writer.Tracer
buffer *gbytes.Buffer
id string
)
BeforeEach... |
d037149c6049d2c4ea70b5af827ba6f52d47d92a | 97958431ccc1d347ce3c4ac504c912b6b0075dae | oktalz/check-commit-test | /check_data_test.go | Go | go | 1,438 | permissive | package main
var tests = []struct {
name string
subject string
wantErr bool
}{
{
name: "valid type and severity",
subject: "BUG/MEDIUM: config: add default location of path to the configuration file",
wantErr: false,
},
{
name: "invalid type and ok severity err front",
subject: "aaaBUG/MEDIUM:... |
4b71fd48343b33e32281b77a9413c19e994621c8 | 987c472caaaa1c09f97f830d0b6b23178757334f | vsopvsop/hugo | /deploy/deploy_test.go | Go | go | 30,398 | permissive | // Copyright 2019 The Hugo 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 ... |
bf0b9bff0e4c4f3d5bee64d1503ad616048a4847 | ecdbc760885dddf0fe19137e2025efcf4a364805 | fsouza/inv_bots | /lib/sender.go | Go | go | 1,427 | permissive | package lib
import (
"crypto/tls"
"io"
"net/smtp"
"sync"
)
// GmailSender sends email using Gmail's SMTP server, reusing the underlying
// SMTP connection.
type GmailSender struct {
conn *smtp.Client
user string
password string
mutex sync.Mutex
}
func NewGmailSender(user, password string) (*GmailS... |
2227faaa6ab22c9725f2846fa7206c5f5f94054e | 48668571301742e019e234666241533bae008694 | muka/go-bluetooth | /_examples/cmd/discovery.go | Go | go | 1,245 | 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
// distribut... |
4759e7206a0e286dccd0ad7dd461d37b3269954d | 14d900a8e6eb3fdc9acdc33eb2a65d5287882afd | toVersus/gopl | /ch07/ex7-6/tempconv.go | Go | go | 1,772 | no_license | // Package tempconv performs Celsius and Fahrenheit conversions.
package tempconv
import (
"flag"
"fmt"
)
type Celsius float64
type Fahrenheit float64
const (
AbsoluteZeroC Celsius = -273.15
FreezingC Celsius = 0
BoilingC Celsius = 100
)
func (c Celsius) String() string { return fmt.Sprintf("%g°C",... |
047fe2c99272cbca03fecee629bb088c9baf0a5d | ba1e196c47e79a6c5affae6e7ac692bd3202e11d | jangocheng/shorm | /sqlgen.go | Go | go | 18,408 | permissive | // Copyright 2016 The shorm 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 shorm
import (
"bytes"
"encoding/json"
"fmt"
"reflect"
"sort"
"strconv"
"strings"
"sync"
)
type opType int8
const (
... |
a1e48140ad9995d864104f39434e33f2646d7e7c | 893f9c30ed093d4a194468ddea1374723d6c3a91 | test-wiz-sec/pulumi-azure-nextgen | /sdk/go/azure/search/v20200801preview/sharedPrivateLinkResource.go | Go | go | 5,554 | 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 v20200801preview
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Describes a Shared Private Link Resource ... |
3331e3c3c84cca594e35830cc9a50bd3ab360580 | 3a3941ad41e1408bdcb08274e25d43e7eef501b8 | cockroachdb/vendored | /github.com/cockroachdb/pebble/sstable/block.go | Go | go | 41,567 | permissive | // Copyright 2018 The LevelDB-Go and Pebble 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 sstable
import (
"encoding/binary"
"unsafe"
"github.com/cockroachdb/pebble/internal/base"
"github.com/cockroachdb/pebble/intern... |
b10ae5763b418ae012513e6f5e45eba9b2c77a7c | d905d50ff71d016364d08e6b2daed14b5a00896e | sector84/spago | /pkg/ml/nn/highway/highway.go | Go | go | 2,095 | permissive | // Copyright 2019 spaGO 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 highway
import (
"github.com/nlpodyssey/spago/pkg/mat"
"github.com/nlpodyssey/spago/pkg/ml/ag"
"github.com/nlpodyssey/spago/pkg/ml/nn"
)
var (
_ nn... |
b400a6845dd04c4d66e82e548e46789a56a3c237 | 49eac97b42d0042ad6bef5ffd5232750e4063337 | cihangir/vitess | /go/vt/vtctl/vtctl.go | Go | go | 79,994 | permissive | // Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package vtctl
import (
"errors"
"flag"
"fmt"
"io/ioutil"
"net"
"sort"
"strconv"
"strings"
"time"
log "github.com/golang/glog"
"github.com/youtube/vite... |
71eddde6271b186d5c7baf301a8ff6a3892e0a7b | 0830818b4f6f4367190449a13887c8fe8da42e38 | clouditor/clouditor | /internal/util/filesystem.go | Go | go | 1,681 | permissive | // Copyright 2023 Fraunhofer AISEC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
57ee7c88567c548485f6b31a724e478fe71f3aef | 254cd38a50d7030496a048b346aec2d7cc7815cb | Brick7Face/flagger | /pkg/canary/util.go | Go | go | 2,195 | permissive | package canary
import (
"crypto/rand"
"fmt"
"io"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr"
flaggerv1 "github.com/weaveworks/flagger/pkg/apis/flagger/v1beta1"
)
var sidecars = map[string]bool{
"istio-proxy": true,
"envoy": true,
}
func getPorts(cd *flaggerv1.Canary, cs []corev1... |
4bb20f09abdacaca53bcdfa496250afe66f9cda5 | 003397bfc4878d16d4d1dd09f6d09cd92ee3d324 | Oldda/rgo | /rgo/tools/str_replace.go | Go | go | 1,601 | no_license | package tools
import (
"errors"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
)
type StrReplaceHelp struct {
root string
originText string
targetText string
cnt int
isRec bool
}
type HandleResult struct{
RunCnt int
Err error
}
var result = &HandleResult{
RunCnt: 0,
Err: nil,
}
func New(root strin... |
b987eee13fb2586c83a920dfc502ca3a3bf49c21 | 017d08d5e681b63bd917e75a739dd06657278157 | marwahaha/vcert-1 | /cmd/vcert/enroll.go | Go | go | 15,193 | permissive | /*
* Copyright 2018 Venafi, 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... |
f382360d65db4ba7a9d9ae96787b719f1abf59e8 | 3550ccddc9893f4d264595aac2469ec5ed52d2f8 | cshari-zededa/eve | /pkg/pillar/cmd/zedrouter/flowstats.go | Go | go | 36,544 | permissive | // Copyright (c) 2019 Zededa, Inc.
// SPDX-License-Identifier: Apache-2.0
// Flow Statistics collection from IPtable Conntrack facility
package zedrouter
import (
"bytes"
"fmt"
"net"
"strconv"
"strings"
"sync"
"time"
"syscall"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/... |
e98d3141e069cfcb4540c01f3ce87b3d742e5f8f | f90fc5dad84f3dbe986bb225d85544f018cbb18c | BobbWu/goa | /middleware/error_handler.go | Go | go | 1,562 | permissive | package middleware
import (
"net/http"
"github.com/goadesign/goa"
"golang.org/x/net/context"
)
// ErrorHandler turns a Go error into an HTTP response. It should be placed in the middleware chain
// below the logger middleware so the logger properly logs the HTTP response. ErrorHandler
// understands instances of ... |
d8fe11137dfe773a648b52be8a4ded8c21a1696b | 53d1645c5d6dc9046c70d44aea069ff5f3552a21 | hyangah/catapult | /web_page_replay_go/src/webpagereplay/adb_cert_installer.go | Go | go | 3,327 | permissive | // Copyright 2017 The Chromium 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 webpagereplay
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"
)
var (
// A temporary directory created to in... |
9eeb6e142310d9f31b1a08c66bf1d1a392da1fab | a9d5b46120312efc5635c6dbdec48e5dde4c0a32 | fredzhou/anagrams_golang | /anagrams.go | Go | go | 660 | no_license | package pkg
import (
// "fmt"
// "strings"
)
func anagrams(seed string) []string {
var result []string
var f func(string, string) []string
f = func (partialSeed string, prefix string) []string {
for i := range partialSeed {
l_prefix := prefix
if len(partialSeed) == 1 {... |
a13af8bbcf7aec44ef047880b21e7ac3951dc476 | ab2670247c21f0a697d4b16a8b12b5ec515ab1fb | relicright/GolangTraining | /GoWebProgramming/Sessions/HMAC/Example2/main.go | Go | go | 2,711 | no_license | package main
import (
)
import (
"net/http"
"io"
"crypto/hmac"
"crypto/sha256"
"fmt"
)
func getCode(data string) string {
// 'hmac.New' returns a new HMAC hash using the given hash.Hash type and key.
// hash.Hash key
h := hmac.New(sha256.New, []byte(`Hz3Fe4578v3`))
//Write additional h... |
304b904e995bb68aba5119e4e789c813a129721b | c0889ab98c10e7057fff5289de818f6de354b055 | dvbnrg/field-services | /supply/postgres/products.go | Go | go | 561 | no_license | package postgres
import (
"database/sql"
"field/supply"
)
type ProductRepository struct {
db *sql.DB
cache []supply.Product
}
func NewProductRepository(db *sql.DB) *ProductRepository {
return &ProductRepository{
db: db,
}
}
func (r *ProductRepository) Save(p *supply.Product) error {
return nil
}
func (... |
eeb43d48758c9732bdc64136b0b7f81f5324dc9e | 5da7aa7f2e56238c63958a3ee221d028582404f5 | DanielCalvo/studies | /Golang/LearnGoWithTests/06_pointersanderrors/main.go | Go | go | 548 | no_license | package main
import (
"errors"
"fmt"
)
var errInsufficientFunds = errors.New("insufficient funds")
type Bitcoin int
type Stringer interface {
String() string
}
type Wallet struct {
balance Bitcoin
}
func (b Bitcoin) String() string {
return fmt.Sprintf("%d BTC", b)
}
func (w *Wallet) Deposit(amount Bitcoin)... |
93db1b98af66b05a0dc3fc7f38ce381336710fee | ecf64f481ae08810be15bee27d01d9723594c074 | diceone/terraform-provider-rke | /rke/provider_test.go | Go | go | 897 | permissive | package rke
import (
"fmt"
"os"
"testing"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/terraform"
)
var testAccProviders map[string]terraform.ResourceProvider
var testAccProvider *schema.Provider
func init() {
testAccProvider = Provider().(*schema.Provider)
testAccProviders ... |
43d2f16f70855f3905356bf8ca7eaf2b554fa79c | 57479e7a9c62dbe2ddd12e7c392284546fc180dd | timuluvus/gogo | /go-cards/deck_test.go | Go | go | 701 | no_license | package main
import (
"os"
"testing"
)
func TestNewDeck(t *testing.T) {
d := newDeck()
if len(d) != 16 {
t.Errorf("Expected deck length of 16, but got %v", len(d))
}
if d[0] != "Ace of Spades" {
t.Errorf("Expected first card of Aces of Spades, but got %v", d[0])
}
if d[len(d)-1] != "Four of Clubs" {
... |
18878613077dd5d16d1e1885a9e701bfede584f6 | debd7501ae6ff10f440f3505abfd2423e0d96440 | langered/bosh-fuzz-tests | /src/github.com/cloudfoundry-incubator/bosh-fuzz-tests/deployment/renderer_test.go | Go | go | 16,569 | permissive | package deployment_test
import (
. "github.com/cloudfoundry-incubator/bosh-fuzz-tests/deployment"
bftinput "github.com/cloudfoundry-incubator/bosh-fuzz-tests/input"
faksesys "github.com/cloudfoundry/bosh-utils/system/fakes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Manifest/Render... |
51ca37a5f03bf524665d4bf04246b368970f6f06 | 517a78d71a116bbeb448d0c1b2ddc6edb0c5eb36 | devintegral2/go-lachesis | /version/version.go | Go | go | 405 | permissive | package version
import (
"github.com/ethereum/go-ethereum/params"
)
func init() {
params.VersionMajor = 0 // Major version component of the current release
params.VersionMinor = 6 // Minor version component of the current release
params.VersionPatch = 0 // Patch version component of the current releas... |
4dfdb0838786cea6940765ee7b07a00a2845d663 | 9cce7b5df88ad60bc1bb87d3426ef27eda625639 | rizalgowandy/httplab | /cmd/httplab/main.go | Go | go | 3,887 | permissive | package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/user"
"strings"
"time"
"github.com/gchaincl/httplab"
"github.com/gchaincl/httplab/ui"
"github.com/jroimartin/gocui"
"github.com/rs/cors"
flag "github.com/spf13/pflag"
)
// VERSION is the current version
const VERSION = "v0.5.0-dev"
// NewH... |
9f9cb3361d109aed695734b06e1741bac9a5c54b | 3ea28f0dedce081d5b2045171e5b4e4a433058c9 | astraw99/gf | /net/ghttp/ghttp_server_config_logging.go | Go | go | 1,822 | permissive | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package ghttp
// SetLogPath sets the log path for server.
// I... |
cfa181763c3878fb8a72964147061a5007ca4d11 | 06d4ac2d107d1b320295a80a3939b50e2d13ea8f | yizhiyan/moby | /integration/container/kill_test.go | Go | go | 5,700 | permissive | package container // import "github.com/helmutkemper/moby/integration/container"
import (
"context"
"testing"
"time"
"github.com/helmutkemper/moby/client"
"github.com/helmutkemper/moby/integration/internal/container"
"github.com/helmutkemper/moby/testutil/request"
"gotest.tools/v3/assert"
is "gotest.tools/v3/... |
016bca4ff7c8271222a1c676e3cec2018c866ae7 | 758116c8c0cc988f792929a5345a22263ee8863e | subbuv26/k8s-bigip-ctlr | /pkg/appmanager/healthMonitors_test.go | Go | go | 34,466 | permissive | /*-
* Copyright (c) 2016-2020, F5 Networks, 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 l... |
d356f4826f1661ca18ef2001b24a2da477fd7d57 | 68cc991b295b6810c159428d9435e0af2abae439 | favish/argo | /cmd/components/components.go | Go | go | 473 | no_license | /*
Base hook for component functionality.
To include in a parent command, add this command to it, all other commands in this package will be
added to this as sub-commands.
This is the only Export from the components package
*/
package components
import (
"github.com/spf13/cobra"
)
var ComponentsCmd = &cobra.C... |
798c23a280dc02a22fcee2c88ab6916f238ce66e | a1adb934cc3e4426ec6a418d78cf643ba707057f | FrankSantoso/go-hydra-login-consent | /internal/cfg/config_test.go | Go | go | 1,413 | no_license | package cfg
import (
"testing"
// "github.com/google/go-cmp"
)
const (
success = "\u2713"
failed = "\u2717"
)
type testConf struct {
name string
path string
}
func TestParseConfig(t *testing.T) {
t.Log("Given the need to parse config file")
{
testConfigsErr := []testConf{
{
name: "Nonexistent path... |
fb568506211e51df46e9d9c3aa8f286710821c53 | e22e1526e1d3a774db9dc405d270060ef913f1ba | banna2019/kubeapps | /cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/release.go | Go | go | 25,756 | permissive | /*
Copyright © 2021 VMware
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
distribut... |
c1f4fbad09115e52c6b4eb538d46206ee7e88de8 | 9cfc5a09884b7f0b901667bb5788a0e802e7064f | Gotzsky/Go-deezer-downloader | /config.go | Go | go | 1,297 | permissive | package main
import (
"flag"
"fmt"
"os"
)
// Config is the configuration of the CLI
type Config struct {
Debug bool
File bool
ID string
UserToken string
}
// Initial value of the config
var cfg = &Config{
false,
false,
"",
"",
}
func debug(msg string, params ...interface{}) {
if cfg.Debu... |
d5b2c5010a8c5e854ec5d86dde00d2cf42c173c6 | 33a3b86cfd0ec6a61cead091b06db65fe3d90ad4 | xingmuyang/htgolang-20200615 | /course/20191214/code/gocmdb/server/routers/router.go | Go | go | 1,162 | no_license | package routers
import (
"github.com/astaxie/beego"
"github.com/imsilence/gocmdb/server/controllers"
v1 "github.com/imsilence/gocmdb/server/controllers/api/v1"
"github.com/imsilence/gocmdb/server/controllers/auth"
)
func init() {
// 认证
beego.Router("/", &controllers.IndexController{}, "get:Index")
// 认证
bee... |
ee5381614098b6de429b84834f053add9ca77157 | a73254c0ac92a7fe055f9a715b15e233068f64ec | carprks/identity-old | /src/identity/update_test.go | Go | go | 1,559 | no_license | package identity
import (
"fmt"
"github.com/joho/godotenv"
"github.com/stretchr/testify/assert"
"os"
"testing"
)
func TestIdentity_Update(t *testing.T) {
if os.Getenv("AWS_DB_TABLE") == "" {
err := godotenv.Load()
if err != nil {
fmt.Println(fmt.Errorf("godotenv err: %v", err))
}
}
create := []struc... |
3fae8bde1441c4b8dd1f0066a1f4d61ced82d799 | a7422b260cb549d1f7bee9d46d4f6126ed4eaf20 | Eric-GreenComb/contrib | /snowflake/flake.go | Go | go | 535 | permissive | package snowflake
import (
"fmt"
flake "github.com/zheng-ji/goSnowFlake"
)
// GIwFlake GIwFlake
var GIwFlake Flake
// Flake Flake
type Flake struct {
iw *flake.IdWorker
}
// Init Init
func (f *Flake) Init(workerid int64) error {
_iw, err := flake.NewIdWorker(workerid)
if err != nil {
fmt.Println(err)
retu... |
4bf5fea9b614a0b5e5306c1298b0bb7f4e3ea8fe | df217b01948c6ff07a16542772eac5be42043fb5 | wolfeidau/dynalock | /v2/doc_test.go | Go | go | 1,561 | permissive | package dynalock_test
import (
"context"
"fmt"
"time"
"github.com/aws/aws-sdk-go-v2/aws/external"
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
"github.com/wolfeidau/dynalock/v2"
)
func ExampleDynalock_NewLock() {
cfg, err := external.LoadDefaultAWSConfig()
if err != nil {
panic("unable to load SDK conf... |
08d82d67598ddebc1623f88836834752d019da1c | 05f0ca3cc9ae8f03dea8449c9a69153b2b59cfcd | penguinn/leetcode | /problems/199.二叉树的右视图/index.go | Go | go | 552 | no_license | package index
import (
"github.com/penguinn/leetcode/common"
)
func rightSideView(root *common.TreeNode) []int {
if root == nil {
return []int{}
}
result := []int{}
result = traverse(root, 0, result)
return result
}
func traverse(root *common.TreeNode, depth int, result []int) []int {
if root == nil {
... |
46439a7bc7e584e3983ed510e29d228105e94f9d | 45e8b6a0884e7e980ec1b37b09bddd1dba1851c7 | xackery/eqcp | /server/account.go | Go | go | 15,071 | permissive | package server
import (
"context"
"database/sql"
"fmt"
"reflect"
"strings"
"time"
"github.com/go-playground/validator"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
"github.com/xackery/eqcp/pb"
//mysql db
_ "github.com/go-sql-driver/mysql"
)
// AccountSearch implements SCRUD endpoints
func (s *Ser... |
f8bac2e3ca08f79fa558670cf404e74ff034bc4a | 746842696ea5a7fd78885ef54ace3ec596c78370 | joshuarubin/zb | /vendor/srcd.works/go-git.v4/plumbing/transport/file/client.go | Go | go | 1,634 | permissive | package file
import (
"io"
"os/exec"
"srcd.works/go-git.v4/plumbing/transport"
"srcd.works/go-git.v4/plumbing/transport/internal/common"
)
// DefaultClient is the default local client.
var DefaultClient = NewClient(
transport.UploadPackServiceName,
transport.ReceivePackServiceName,
)
type runner struct {
Upl... |
cb4379dafab942b0d7b69520631ae127476cc542 | a8f1bbc335e77d8449dda98985b47f391f2c1424 | peixiaochen/blog-1 | /model/sys_api.go | Go | go | 2,803 | permissive | package model
import "time"
// Api 接口
type Api struct {
Id int `xorm:"INT(11) PK AUTOINCR comment('主键')" json:"id"`
Name string `xorm:"VARCHAR(255) comment('名称')" json:"name"`
Path string `xorm:"VARCHAR(255) comment('路径')" json:"path"`
Group string `xorm:"VARCHAR(255) comment('组')... |
d80d05502623e2e4e1050b2cc1cd9ff56be71d6e | f43c8ee0b2ddb32eb60b641f8d1daf6469a9fae1 | upwork/cert-manager | /pkg/controller/certificate-shim/helper.go | Go | go | 3,064 | permissive | /*
Copyright 2020 The cert-manager Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing... |
607c4ddcc660966a266d17dcbc7c936e459f73b6 | 9e97bc8f275065610d8782104121f479d9e73bfd | isabella232/secrets-store-csi-driver | /pkg/secrets-store/nodeserver_test.go | Go | go | 17,741 | permissive | /*
Copyright 2020 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, ... |
d7c4732f7ce3ef6adce383c47b299d7fe8c438d7 | 759d45b7887f8a41c2be19cd61789e6754b5186b | faruqisan/resilia | /cmd/main.go | Go | go | 1,027 | no_license | package main
import (
"flag"
"log"
"time"
httpserver "github.com/faruqisan/resilia/engine/servers/http"
"github.com/faruqisan/resilia/engine/suites/services"
"github.com/faruqisan/resilia/pkg/kube"
"github.com/faruqisan/resilia/pkg/pumba"
)
var (
inCluster bool
httpPort string
)
func main() {
flag.BoolV... |
5cd838868de2fa7101413bd26f97f5ec246b62d8 | 43f49e9c5d31ae4d6972df15254f6568060fb2cf | sky4access/algo | /array/connect_sticks_test.go | Go | go | 261 | no_license | package array
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestConnectSticks(t *testing.T) {
result := connectSticks([]int{2, 4, 3})
assert.Equal(t, 14, result)
result = connectSticks2([]int{1, 8, 3, 5})
assert.Equal(t, 30, result)
}
|
90bbcd75d8be29d1b9ed71b4201117176f6a1a3f | cbe94f02ed93caa3c72b3bc7f2a8c9bdb126630d | 920oj/get-programming-with-go | /gpwg_go/app/LESSON3/compare.go | Go | go | 240 | no_license | package main
import "fmt"
func main() {
fmt.Println("入口の近くに「未成年立入禁止」という立て札がある")
var age = 21
var minor = age < 18
fmt.Printf("%v歳のぼくは未成年ですか? %v\n", age, minor)
} |
d41f9e1991f23994ccf6736183507b764b16ef20 | 2477ced67568b101f7f79249742a8e8a72177966 | laoqiu/aliyun-sms-sdk | /template.go | Go | go | 2,750 | no_license | package sms
type AddSmsTemplateRequest struct {
CommonRequest
// 短信类型。其中:
// 0:验证码。
// 1:短信通知。
// 2:推广短信。
// 3:国际/港澳台消息。
TemplateType int
// 模板名称,长度为1~30个字符
TemplateName string
// 模板内容,长度为1~500个字符
TemplateContent string
// 短信模板申请说明
Remark string
}
type SmsTemplateResponse struct {
Message string `j... |
8da0a0df13cdc0d609610a2b87be040cbecd8d04 | 5a6e078e7b1797ba36dd57d56cb9b2c5b8f4acfe | tamnd/gauth | /provider/behance/user.go | Go | go | 424 | permissive | package box
import (
"fmt"
"github.com/tamnd/gauth"
"github.com/tamnd/httpclient"
)
var endpointProfile = "https://www.behance.net/v2/users/"
func User(token *gauth.AccessToken) (*gauth.User, error) {
URL := endpointProfile + "?access_token=" + token.Token
fmt.Println(URL)
content, err := httpclient.String(UR... |
94e2c3aa9e6f67f6a346a6a3bf49241fcc45088e | 07efedead380492b0bbb43d840978609072ab3d5 | adam-hanna/lotus | /blockstore/splitstore/splitstore_reify.go | Go | go | 3,313 | permissive | package splitstore
import (
"errors"
"runtime"
"sync/atomic"
"github.com/ipfs/go-cid"
blocks "github.com/ipfs/go-libipfs/blocks"
"golang.org/x/xerrors"
)
var (
errReifyLimit = errors.New("reification limit reached")
ReifyLimit = 16384
)
func (s *SplitStore) reifyColdObject(c cid.Cid) {
if !s.isWarm() {
... |
578e132abb0be3f78845deea393d041fdaadb95c | a68de656e278488139717eae4bd736df8003868e | metcalf/raft | /log_entry.go | Go | go | 2,070 | permissive | package raft
import (
"bytes"
"encoding/json"
"fmt"
"io"
"code.google.com/p/gogoprotobuf/proto"
"github.com/metcalf/raft/protobuf"
)
// A log entry stores a single item in the log.
type LogEntry struct {
pb *protobuf.LogEntry
Position int64 // position in the log file
log *Log
event *ev
}
//... |
e830fc7b7dd268f22b1ac35dd7296bf4e5f7b0e2 | 8d1c14b3d4c1dbeafe9904968602179d8a7e6f8e | shicongbuct/canchain | /common/bytes.go | Go | go | 1,580 | no_license | package common
import "encoding/hex"
func ToHex(b []byte) string {
hex := Bytes2Hex(b)
if len(hex) == 0 {
hex = "0"
}
return "0x" + hex
}
func FromHex(s string) []byte {
if len(s) > 1 {
if s[0:2] == "0x" || s[0:2] == "0X" {
s = s[2:]
}
}
if len(s)%2 == 1 {
s = "0" + s
}
return Hex2Bytes(s)
}
fun... |
0368abb7672839f958e7099e2a6fc5c288e78d44 | b72c96eb105bc9073ebb39c6462c2b3c2166948d | stsully/oci-go-sdk | /opsi/sql_statistics_time_series_aggregation.go | Go | go | 1,273 | permissive | // Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
5fbf9145131bcd53cd610f394e6cbd895a11d1f9 | fa078836d10339ab705178b84dd7a52e30286831 | damoodamoo/databricks-terraform | /client/model/notebook.go | Go | go | 1,231 | permissive | package model
// Language is a custom type for language types in Databricks notebooks
type Language string
// ObjectType is a custom type for object types in Databricks workspaces
type ObjectType string
// ExportFormat is a custom type for formats in which you can export Databricks workspace components
type ExportFo... |
ad477e445bc7f4509a3c1071ee39383bc86945f9 | 50b0f82a4aa6f2982a21e82e106b71f50e33dc44 | rueyxian/go-gist | /topic/concurrency/11-factory/02-pipeline/02-buffered/main.go | Go | go | 606 | no_license | package main
import "fmt"
func main() {
sendCh := sendNums(1, 3, 5, 7, 9)
recvCh := recvNums()
for n := range sendCh {
recvCh <- n
}
close(recvCh)
fmt.Println("====================")
// ====================
}
func sendNums(nums ...int) <-chan int {
ret := make(chan int, len(nums))
for _, n := range nu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.