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 |
|---|---|---|---|---|---|---|---|---|
c446189dfcdb89bbc8605e03ec34c18140d4f53f | f5c1542ce0190bc395a16a54cc188eea341cc25d | slyaniki/piscine-go | /comcheck/main.go | Go | go | 414 | no_license | package main
import (
"fmt"
"os"
)
func main() {
var arrayRune []rune
var result string
safeWords := []string{"01", "galaxy", "galaxy 01"}
for i := 1; i < len(os.Args); i++ {
arrayRune = []rune(os.Args[i])
}
for j := 0; j < len(arrayRune); j++ {
if arrayRune[j] != ' ' {
result += string(arrayRune[j])... |
62576df2ce76279ace551f79a507b6a4ab65a4eb | d387af57a8da5985593c332b967f4eb3ce0fc4f5 | elhardoum/CookieScanner | /cmd/server/main.go | Go | go | 13,644 | permissive | /*
* Copyright 2019 The CovenantSQL 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 ... |
401ff24c14244aa02d483be057c4be877e1f95f2 | bdf22af64e083ec29f49ad22eefb01101f410abf | xiangsikai/kubernetes | /pkg/kubelet/util.go | Go | go | 870 | permissive | /*
Copyright 2016 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, ... |
80907891a722adfebef9bfd7083c578e4c525412 | d45c1f72a76b61776ef7c36ba8cc42fa630d3310 | tohutohu/traQ | /rbac/permission/userTag.go | Go | go | 570 | permissive | package permission
import "github.com/mikespook/gorbac"
var (
// GetTag : ユーザータグ取得権限
GetTag = gorbac.NewStdPermission("get_tag")
// AddTag : ユーザータグ追加権限
AddTag = gorbac.NewStdPermission("add_tag")
// RemoveTag : ユーザータグ削除権限
RemoveTag = gorbac.NewStdPermission("remove_tag")
// ChangeTagLockState : ユーザータグロック状態変更権限... |
902daea6bd1fe373f8d5c9f727baf4035305bd79 | 1ac5d8cfeadfb58c4e2e86613de46e3884ff479a | huaweicloud/huaweicloud-sdk-go-v3 | /services/nlp/v2/model/model_create_poem.go | Go | go | 1,844 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"errors"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
"strings"
)
// CreatePoem
type CreatePoem struct {
// 诗歌标题,目前仅支持UTF-8编码,仅支持中文,长度为1-10
Title string `json:"title"`
// 诗歌类型,取值如下: 0:五言绝句; 1:七言绝句; 2:五言律诗; 3:七... |
52417477cf765e52b06c97f00b954eaaaeaef950 | 76c2c9c8aa7765bbdca577c3cbdafc4ca4d15182 | taozhang-tt/go-library | /leetcode/0164-maximum-gap/main.go | Go | go | 950 | no_license | package main
import "sort"
/*
164. 最大间距
https://leetcode-cn.com/problems/maximum-gap/
题目描述:
给定一个无序的数组,找出数组在排序之后,相邻元素之间最大的差值。
如果数组元素个数小于 2,则返回 0。
示例1:
输入: [3,6,9,1]
输出: 3
解释: 排序后的数组是 [1,3,6,9], 其中相邻元素 (3,6) 和 (6,9) 之间都存在最大差值 3。
示例2:
输入: [10]
输出: 0
解释: 数组元素个数小于 2,因此返回 0。
说明:
你可以假设数组中所有元素都是非负整数,且数值在 32 位有符号整数范... |
cac1b20992a5b5a8ca1403e7334f77409fcbebb5 | 7d3cbea8a46802772aa6916f59aabfac56804231 | ljy1814/leet | /32-longest-valid-parentheses/32.go | Go | go | 1,992 | no_license | package main
import "fmt"
type Stack struct {
stack []int
top int
capcity int
}
func (s *Stack) push(i int) {
if s.top == s.capcity-1 {
s.capcity++
s.top++
s.stack = append(s.stack, i)
return
}
s.top++
s.stack[s.top] = i
}
func (s *Stack) pop() int {
t := s.stack[s.top]
s.top--
if s.capcity... |
eda0a93e56395938fe027092977b4b991fd0228c | 9184b6b4b450149d748ddef51bed022139520827 | selihc/httpz | /internal/csp/policy.go | Go | go | 2,748 | permissive | package csp
import (
"fmt"
"net/url"
"strings"
"sync"
)
type Policy struct {
m sync.Mutex
v map[string][]string
}
func NewPolicy() *Policy {
return &Policy{
v: make(map[string][]string),
}
}
func (p *Policy) Set(dir string, sources ...string) *Policy {
p.m.Lock()
defer p.m.Unlock()
if legalKey(dir) {
... |
c97cfdd7ada2879e6e13f20c78b071c37726a26a | 32cd9c380273293f0624b2fcca7289bc3c1fd02c | kellen/beam | /playground/backend/internal/code_processing/code_processing.go | Go | go | 28,356 | permissive | // Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not... |
ae61457daa4dc16150e972c1d148413554e16248 | 438bc93a2e88cfea8d3fb1a1b95106ab12b2aea6 | ondrej-fabry/vpp-agent | /cmd/agentctl/client/vpp.go | Go | go | 1,121 | permissive | // Copyright (c) 2019 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... |
d3d28081309f45f7c10f63f4c9435201620eb022 | ebb68f20bedfe5185e66abe950aadb2a29dc9330 | timkao/basicGo | /channelDemo/channelFactory.go | Go | go | 298 | no_license | package main
import (
"fmt"
"time"
)
func main() {
stream := pump()
go suck(stream)
time.Sleep(1e9)
}
func pump() chan int {
ch := make(chan int)
go func() {
for i := 0; i < 10; i++ {
ch <- i
}
}()
return ch
}
func suck(ch chan int) {
for v := range ch {
fmt.Println(v)
}
}
|
20ff50f5757004d297a40aacf0709c2161ed4677 | 31af84d1ae0c0b3f0793cd64d0a00488db23a059 | snailshen2014/research | /go/gwp-master/Chapter_10_Deploying_Go/mosaic-standalone/mosaic.go | Go | go | 2,505 | no_license | package main
import (
"fmt"
"image"
"image/color"
"io/ioutil"
"math"
"os"
)
// resize an image by its ratio e.g. ratio 2 means reduce the size by 1/2, 10 means reduce the size by 1/10
func resize(in image.Image, newWidth int) image.NRGBA {
bounds := in.Bounds()
width := bounds.Max.X - bounds.Min.X
ratio := w... |
7a038bf282c453e42e23e414b50c5c4a8426c1a8 | ccd4791c1456bdff67139855a40a28b1d4548292 | Savasw/pipeline | /cmd/pipeline/main.go | Go | go | 30,476 | permissive | // Copyright © 2018 Banzai Cloud
//
// 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 ... |
34329e9d6837bd79f508e85564ca826acec30040 | 4548607e2bc5aec30b90526ae2ff311d7822c409 | jonjohnsonjr/pipeline | /test/builder/pipeline.go | Go | go | 16,836 | permissive | /*
Copyright 2019 The Tekton 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, softw... |
bc8ae9ce2d822ef9b74d2726ae95bea5fb1d9f32 | 3f8f92b56d845b2fed2a689aae0f84ed1e93ed65 | cyrilhl/aries-framework-go | /pkg/crypto/tinkcrypto/primitive/composite/register_ecdh_aead_enc_helper_test.go | Go | go | 7,102 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package composite
import (
"crypto/elliptic"
"encoding/base64"
"encoding/hex"
"encoding/json"
"fmt"
"testing"
"github.com/google/tink/go/aead"
subtleaead "github.com/google/tink/go/aead/subtle"
"github.com/... |
96a94767cef37bd089d4c763970d0bd6d8b09b97 | 33fe416dc4a51c7fa31c3ea4d1981523664677a6 | micvbang/go-helpy | /uinty/gen_set.go | Go | go | 842 | permissive | package uinty
import "github.com/micvbang/go-helpy"
// Code generated. DO NOT EDIT.
// NOTE: this type is deprecated. Use helpy.Set instead
type Set helpy.Set[uint]
func (s Set) t() helpy.Set[uint] {
return helpy.Set[uint](s)
}
func (s Set) Intersect(s2 Set) Set {
return Set(s.t().Intersect(s2.t()))
}
func (s S... |
c0071b9b04e42a5afecae43c4961832c849abda2 | aa46b594e65a173c94bb34f856b4f6adee8e5de5 | UfaSemen/testConsul | /main.go | Go | go | 489 | no_license | package main
import (
"flag"
"fmt"
)
const (
address = "192.168.0.1"
port = "3333"
serviceName = "testService"
key = "testKey"
value = "testValue"
)
func main() {
mode := flag.String("m", "server", "")
flag.Parse()
switch *mode {
case "server":
err := serverStart()
if err != n... |
ab5b4031121558dbb54572480e15ce1397dc1707 | dcb82a789eab2ed6a9474e3daef5e95650a8ec58 | SmallPepperZ/absol | /modules/alert/site.go | Go | go | 7,803 | permissive | package alert
import (
"bytes"
"encoding/json"
"encoding/xml"
"errors"
"fmt"
"github.com/bwmarrin/discordgo"
"github.com/lordralex/absol/api/database"
"github.com/lordralex/absol/api/logger"
"github.com/spf13/viper"
"io/ioutil"
"net/http"
"net/url"
"strings"
"time"
)
type site struct {
SiteName str... |
a7bce197c3b27ae5566cf7dc77bace0933e4b490 | bd95153f40570cc4e3baf88b779edc5174d12d6f | munnerz/kubernetes | /contrib/mesos/pkg/scheduler/podtask/port_mapping.go | Go | go | 5,608 | permissive | /*
Copyright 2015 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... |
a12a1370278fbe5bcb7729b13a45f0c22a85e6ce | 79c7b1860708e38441d3515434b29e1e36cea305 | sonatard/go-loom | /prefix.go | Go | go | 282 | permissive | package loom
import (
"github.com/loomnetwork/go-loom/util"
)
func PermPrefix(addr Address) []byte {
return util.PrefixKey(contractPrefix(addr), []byte("permission"))
}
func contractPrefix(addr Address) []byte {
return util.PrefixKey([]byte("contract"), []byte(addr.Local))
}
|
e6c45e442222441bf6051a16578996d8fb1988f6 | de11a72fdf9f983e9446aaf9f221386c6df441f7 | saper150/riggedstars | /app/user/userManager.go | Go | go | 6,187 | no_license | package user
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"riggedstars/app/db"
"riggedstars/app/models"
"strings"
jwt "github.com/dgrijalva/jwt-go"
"github.com/gorilla/mux"
"golang.org/x/crypto/bcrypt"
)
type createUserForm struct {
Name string
Password string
}
type responseForm struct {
... |
0b2c6ef90c4a62fdf8e3e4013c637b30e16d3352 | f241b56fa816e4348748edbdbed581bda5ec9660 | jtavernier/isvr | /cli/command/delete/cmd.go | Go | go | 517 | no_license | package delete
import (
"github.com/jtavernier/isvr/cli"
"github.com/jtavernier/isvr/cli/command"
"github.com/spf13/cobra"
)
// NewDeleteCommand returns a cobra command for `delete` subcommands
func NewDeleteCommand(isvrCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "delete",
Short: "Delete o... |
0fdb54df50520f2a85efbb786627c1f147174aef | 0dec69eab1a86167d572f0f7ddb540cd4b9c563b | Byehalcyondays/go_study | /forexercise/main.go | Go | go | 323 | no_license | package main
import "fmt"
func main() {
var totallevel int = 9
for i := 1; i <= totallevel; i++ {
for j := 1; j <= totallevel-i; j++ {
fmt.Print(" ")
}
for k := 1; k <= 2*i-1; k++ {
if k == 1 || k == 2*i-1 || i == totallevel {
fmt.Print("*")
} else {
fmt.Print(" ")
}
}
fmt.Println()
}... |
9dfa53324b06f38f1404673cf8f2db83c3d4f489 | c5c331ddb984ad8bae3907448a681a11238f7fb5 | ellavs/golangconf19_examples | /handmade/render/webgl_texture.go | Go | go | 1,838 | no_license | package render
import (
"github.com/nuberu/webgl"
"github.com/nuberu/webgl/types"
"syscall/js"
)
type (
Texture struct {
tex *types.Texture
gl *webgl.RenderingContext
size Point
}
TextureLoadCallback func(*Texture)
)
func isPowerOfTwo(val int) bool {
return (val & (val - 1)) == 0
}
// https://develo... |
a3b5c04acf8324c677b68de1d324b0175f5d0bc0 | c8ecde79d12122003866589afbea287d16e27541 | BelodedAleksey/go_historian | /go/cmd/util.go | Go | go | 4,759 | no_license | package main
import (
"fmt"
"io/ioutil"
"os"
"strconv"
"strings"
"time"
"github.com/360EntSecGroup-Skylar/excelize"
"github.com/nanitefactory/winmb"
)
//Парсинг timestamp->время
func str2Time(str string) time.Time {
str = strings.ReplaceAll(str, " ", "")
day, _ := strconv.Atoi(str[0:2])
month, _ := strcon... |
913cec91dcc858798e8a8715ccf318279d9a97b8 | 4684c743f55b45612d6ac8f7f8a8fb3b65cc4fc9 | jmleefree/poc-cicd-ladybug | /src/grpc-api/cbadm/cmd/healthy.go | Go | go | 616 | permissive | package cmd
import (
"github.com/spf13/cobra"
)
// ===== [ Constants and Variables ] =====
// ===== [ Types ] =====
// ===== [ Implementations ] =====
// ===== [ Private Functions ] =====
// ===== [ Public Functions ] =====
// NewHealthyCmd - Ladybug 상태를 수행하는 Cobra Command 생성
func NewHealthyCmd() *cobra.Command... |
cd40fb9b3d2e498d239b42a3c31ecedf126b9eea | 1f1e9e543df3e1d94f6ff057e0e691032041d38d | baseonballs/velero | /pkg/controller/pod_volume_backup_controller_test.go | Go | go | 13,220 | permissive | /*
Copyright The Velero Contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
6b24aa06d177154f1d5d4db45e48d71b13009856 | 603916fa61aa5fc34651d3f8299a03b4e96aaef2 | jbampton/lab | /cdn/manager.go | Go | go | 1,845 | permissive | package cdn
import (
"bytes"
"context"
"fmt"
"net/http"
"sync"
"github.com/pkg/errors"
)
type Manager struct {
server *http.Server
nodes []*Node
running bool
}
func New() *Manager {
return &Manager{
nodes: make([]*Node, 0, 10),
}
}
func (m *Manager) IsRunning() bool {
return m.running
}
func (m *... |
c06530f04c87529f77a20daf21f0ea973e390907 | a2265207e3c44dae687621e79ef4b735668ac60b | dunglp/marvel-service | /pkg/domain/credentials_test.go | Go | go | 1,974 | no_license | package domain
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestCredentials_ToMd5Hash(t *testing.T) {
t.Run("success", func(t *testing.T) {
hashed, err := toMd5Hash(Credentials{
PublicKey: "public_key",
PrivateKey: "private_key",
Ts: ... |
a5e50d4293aaa8f3ae732119c4229e958ad0c8cb | 4aec4a4da20745820f9d1851f8b6410a83a33110 | picarodias/neofs-api-go | /v2/session/test/generate.go | Go | go | 4,985 | permissive | package sessiontest
import (
acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test"
refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test"
"github.com/nspcc-dev/neofs-api-go/v2/session"
)
func GenerateCreateRequestBody(empty bool) *session.CreateRequestBody {
m := new(session.CreateRequestBody)
if !empty {
... |
501986eacf07470ec5e6dc8eef155be3999425bc | 42385a862c55ce1377c03136eff83bf4ebeb97c9 | athega/whistler | /Godeps/_workspace/src/github.com/peterhellberg/lobsters/client.go | Go | go | 1,944 | permissive | package lobsters
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
)
const (
libraryVersion = "0.0.1"
userAgent = "lobsters.go/" + libraryVersion
)
// A Client communicates with the Lobsters API.
type Client struct {
Stories StoriesService
// BaseURL is the base url for Lobsters API.
BaseURL *url.UR... |
b5eee2d25b216b85399ce279d634f1bf57062a83 | c1dd8c4bfd06874e0e4ec31cb38c00af6e843dd5 | ngaut/aresdb | /memstore/bootstrap.go | Go | go | 15,596 | permissive | // Copyright (c) 2017-2018 Uber Technologies, 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 applicabl... |
6da1fb11964d48acae0dbc7f09d42f1243936e88 | bfadf289f88cd51c242d146fa5a56a8e12bfc7d1 | Woovapp/minio | /cmd/object-handlers.go | Go | go | 79,069 | permissive | /*
* Minio Cloud Storage, (C) 2015-2018 Minio, 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 applicab... |
8075f8d0a14ebcf297541216c7834f72e38f9f43 | f9880d26b4609101335e92692b41266d943813e3 | caixw/apidoc | /internal/lsp/protocol/folding_test.go | Go | go | 937 | permissive | // SPDX-License-Identifier: MIT
package protocol
import (
"testing"
"github.com/issue9/assert/v3"
"github.com/caixw/apidoc/v7/core"
"github.com/caixw/apidoc/v7/internal/xmlenc"
)
func TestBuildFoldingRange(t *testing.T) {
a := assert.New(t, false)
base := xmlenc.Base{}
a.Equal(BuildFoldingRange(base, false... |
595a4ef65ae67ee0e76472e0393a20fec2fbdedb | dfbb02ab588da9cdaf03839df840c9ba1d9d7eab | isgasho/flytepropeller | /pkg/controller/nodes/dynamic/handler_test.go | Go | go | 12,072 | permissive | package dynamic
import (
"context"
"fmt"
"testing"
"github.com/lyft/flyteidl/clients/go/events"
"github.com/lyft/flyteidl/gen/pb-go/flyteidl/core"
"github.com/lyft/flyteplugins/go/tasks/v1/types/mocks"
"github.com/lyft/flytestdlib/promutils"
"github.com/lyft/flytestdlib/storage"
"github.com/stretchr/testify/... |
dba03be8919f98e526da4d1817c5517abe0f2f4a | 47fd59d843b94690723f173c8cbd33425de9dc9d | candice9749/ZDHsys | /tests/default_test.go | Go | go | 949 | no_license | package test
import (
"net/http"
"net/http/httptest"
"testing"
"runtime"
"path/filepath"
_ "ZDHsys/routers"
"github.com/astaxie/beego"
. "github.com/smartystreets/goconvey/convey"
)
func init() {
_, file, _, _ := runtime.Caller(0)
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(fi... |
b6ecb55c822292072f16cd2e1ab14cac6edb328b | 07db5a536d6f829d2cf7b40d0087e006af4a5531 | nguyenvandungb/ethermint | /x/evm/keeper/state_transition.go | Go | go | 18,407 | permissive | package keeper
import (
"math/big"
"github.com/palantir/stacktrace"
tmtypes "github.com/tendermint/tendermint/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x... |
cfc64d10bb33263d6f2cd157834e9739beac0509 | 1f005d35bfb1a22b44a253be8f43d102c1da4742 | sadiqmmm/gitea | /routers/private/hook_pre_receive.go | Go | go | 17,014 | permissive | // Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// Package private includes all internal routes. The package name internal is ideal but Golang is not allowed, so we use private as package name instead.
pac... |
92d0ea532c7b55f09d55c80908a40f3b377bf502 | b8ee7a30708152952eb14feb6c1d7ce9600e60b5 | rhonnava/notary | /server/storage/sqldb.go | Go | go | 8,524 | permissive | package storage
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"strconv"
"time"
"github.com/Sirupsen/logrus"
"github.com/docker/notary/tuf/data"
"github.com/go-sql-driver/mysql"
"github.com/jinzhu/gorm"
)
// SQLStorage implements a versioned store using a relational database.
// See server/storage/models.go
... |
5877d5adc59fc76924e95668315a9cda25b6a46b | d5e4057933bfdf6e3c77b6f8e057a3a1c14816f4 | bombsimon/tempo | /vendor/github.com/cortexproject/cortex/pkg/storegateway/bucket_stores.go | Go | go | 19,716 | permissive | package storegateway
import (
"context"
"fmt"
"io/ioutil"
"math"
"net/http"
"os"
"path/filepath"
"strings"
"sync"
"time"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/oklog/ulid"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus... |
114df283f1a0a5a5e1f16b689c9a51194f7c0b7e | 6a8be7b129dabc2ed9f44433b75a93014ba7e280 | pushdown99/package | /src/hancom/hancom.go | Go | go | 39,233 | no_license | package main
import (
"C"
"bytes"
"context"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"
"net/url"
"os"
"os/exec"
"strconv"
"strings"
"sync"
"time"
"github.com/getlantern/systray"
"github.com/gorilla/websocket"
"github.com/jacobsa/go-serial/serial"
"github.com/jas... |
5abe72c49084f4ba8369ddcbfbbbd3b99b48ae17 | b32073f0b79ec554117a3a8ce9b70a4b9c025489 | BLOCKCHAINS-FULL-STACK/sourcegraph | /internal/database/search_contexts.go | Go | go | 18,244 | permissive | package database
import (
"context"
"database/sql"
"errors"
"fmt"
"sort"
"github.com/keegancsmith/sqlf"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourcegraph/sourcegraph/internal/api"
"github.com/sourcegraph/sourcegraph/internal/database/basestore"
"github.com/sourcegraph/sourcegraph/... |
41d1eff905125716b7889999fbc943686cab3d42 | 87adcc1e9213811793c7a8a904db5e96a8bd6e3c | klauspost/minio | /cmd/crypto/sse.go | Go | go | 6,004 | permissive | // MinIO Cloud Storage, (C) 2015, 2016, 2017, 2018 MinIO, 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... |
ebeaf13881f0cd9d98de6ab8d37c026565b0255a | 8a082611fa18ed8181b01d242737728131839c58 | erda-project/erda | /internal/apps/dop/endpoints/workbench.go | Go | go | 1,825 | permissive | // Copyright (c) 2021 Terminus, 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 agree... |
46baf5b78e78e50737dcb1910f4c814cfd759a32 | 58df35fff011284f76904cc2eb44235220ca1cad | edgexfoundry/go-mod-core-contracts | /dtos/resourceoperation.go | Go | go | 1,388 | permissive | //
// Copyright (C) 2020-2021 IOTech Ltd
//
// SPDX-License-Identifier: Apache-2.0
package dtos
import "github.com/edgexfoundry/go-mod-core-contracts/v3/models"
type ResourceOperation struct {
DeviceResource string `json:"deviceResource" yaml:"deviceResource" validate:"required"` // The replacement of Ob... |
0ca76882f9d7cd23f8f283a380d7e1646d55b0dd | b77a98f038d4780209f03bebc2e6ce051c9d65e6 | ehudthelefthand/golang-exp | /oauth2/main.go | Go | go | 2,293 | no_license | package main
import (
"crypto/rand"
"encoding/base64"
"io/ioutil"
"net/http"
"strings"
"time"
"github.com/gin-gonic/gin"
"golang.org/x/oauth2"
)
const authorizeURL = "https://www.dropbox.com/oauth2/authorize"
const tokenURL = "https://www.dropbox.com/oauth2/token"
const redirectURL = "http://localhost:8080/c... |
02737a2412007a8a1f7831b5dd3d4db9b48c271f | e8537997f37ac7d6c25f59dce60ea40088967ca1 | LibenHailu/2FInventory | /intitiator/server.go | Go | go | 820 | no_license | package intitiator
import (
"log"
"net"
grpcserver "github.com/LibenHailu/2FInventory/cmd/item/grpc_server"
"github.com/LibenHailu/2FInventory/cmd/item/itempb"
"github.com/LibenHailu/2FInventory/internal/module/item"
"github.com/LibenHailu/2FInventory/internal/storage/persistance"
"github.com/LibenHailu/2FInve... |
0ded980845fe53d25e2433fdbb821eaa036f5698 | ebc158944a28f581a8afea4896fe4cac3a3262ee | blackbracken/ping-and-report | /slack/slack.go | Go | go | 1,523 | no_license | package slack
import (
"bytes"
"fmt"
"math"
"net/http"
"ping-and-report/repo"
"strings"
"time"
)
var cfg = repo.GetConfigRepository()
func ReportServerUp(addr string) error {
return sendMessage(convertVariables(cfg.Message.ServerUp, addr))
}
func ReportServerDown(addr string) error {
return sendMessage(con... |
4fdf39417dce6e6364ab9b2e6815ed4da95e3aa2 | ecf06312e50c42aa10facd70f5f358256928d701 | zrcni/go-discord-music-bot | /bot/utils.go | Go | go | 3,337 | no_license | package bot
import (
"bytes"
"fmt"
"os"
"strings"
"time"
"github.com/bwmarrin/discordgo"
"github.com/pkg/errors"
"github.com/rylio/ytdl"
log "github.com/sirupsen/logrus"
"github.com/zrcni/go-discord-music-bot/audiorepository"
"github.com/zrcni/go-discord-music-bot/bot/commands"
"github.com/zrcni/go-discor... |
f69dec04fd2a0952e5a8e359322e9ef8d3aa59c2 | 52bd8ca0cd5e3507ad684fb1f4d655fb7ca83cde | ngaut/minio | /test-utils_test.go | Go | go | 22,925 | permissive | /*
* Minio Cloud Storage, (C) 2015, 2016 Minio, 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 applica... |
fc8c061ca39c7942a1d1b225c4b1529331a58a33 | 76578c781a1ebc77a098549540fc358b424b9129 | agoric-labs/cosmos-sdk | /server/rosetta/client_online.go | Go | go | 15,160 | permissive | package rosetta
import (
"bytes"
"context"
"encoding/base64"
"encoding/hex"
"errors"
"fmt"
"regexp"
"strconv"
"time"
"github.com/cosmos/cosmos-sdk/version"
abcitypes "github.com/tendermint/tendermint/abci/types"
rosettatypes "github.com/coinbase/rosetta-sdk-go/types"
"google.golang.org/grpc/metadata"
... |
4af6eb280737242606cdc5403ea5293994762482 | 3a75ce374ce4f1be901ed615c980a005b86af73f | mikqi/wtf | /opsgenie/widget.go | Go | go | 1,635 | permissive | package opsgenie
import (
"fmt"
"strings"
"github.com/olebedev/config"
"github.com/senorprogrammer/wtf/wtf"
)
// Config is a pointer to the global config object
var Config *config.Config
type Widget struct {
wtf.TextWidget
}
func NewWidget() *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(" ⏰ Ops... |
7956274f3f5d6ade5586bee4c1a00cdc9c104d75 | 44c4eecb2905b60b6b942c1ebd01da21565885e7 | say4n/eightyfive | /emulator/datatransfer.go | Go | go | 7,459 | permissive | package emulator
import (
"encoding/hex"
"fmt"
"log"
"strings"
)
func (e5 *eightyfive) handleMOV(instruction string) {
contents := strings.Split(instruction, " ")
target := contents[1]
source := contents[2]
if source == "M" {
// MOV r, m
log.Println("emulator.instructionset.handleMOV:MOV r, m")
address... |
9f02476bd94d8673df0ff240917a1701ad2734c7 | 6345e3d0a272f3dfad9a2a95b95e050ad8b99cab | tkhskt/goriyak | /db/public/transaction_test.go | Go | go | 368 | permissive | package public
import (
"testing"
"time"
)
func TestPutTransaction(t *testing.T) {
tr := &PublicTransaction{ID: "test5",
Name: "testNode",
SendNodeID: "send",
ReceiveNodeID: "receive",
Amount: 0.00,
Status: "approved",
CreatedAt: time.Now(),
}
err := tr.PutTransaction()
... |
281fed4750fba39ceb4664bd624ec4ae3363f67a | ff08f3ee76e703783ba631daddb3ed6350902109 | bhargavskr/golang | /src/github.com/bhargavskr/golangTraining/webDev/understanding_tcp_server/read/main.go | Go | go | 421 | no_license | package main
import (
"bufio"
"fmt"
"log"
"net"
)
func main() {
li, err := net.Listen("tcp", ":8080")
if err != nil {
log.Fatalln(err)
}
defer li.Close()
for {
conn, err := li.Accept()
if err != nil {
log.Fatalln(err)
}
go handle(conn)
}
}
func handle(conn net.Conn) {
scanner := bufio.NewS... |
e35118d83581789521aa6789d7ba4ded70825950 | 272a98e8f713c5c241cb8ca0b1c393b484e0881a | g0tzer0/coyote | /web/model/feature.go | Go | go | 556 | permissive | package model
import (
"github.com/g0tzer0/coyote/entity"
"github.com/g0tzer0/coyote/web/data"
)
var (
featureRepository = data.NewFeatureRepository()
)
// GetFeaturesByID : Get feature definition by cartodbId
func GetFeaturesByID(cartodbID int) ([]entity.FeatureEntry, error) {
return featureRepository.GetByID(c... |
e88cb1ee8429b740645d3e7bbbe7a564d989d501 | bc4afecff9ff8f35cc06ab9472c00853b0a55140 | davidkel/sandbox | /fungible/cc/vendor/github.com/hyperledger-labs/fabric-token-sdk/token/core/fabtoken/auditor.go | Go | go | 518 | no_license | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package fabtoken
import "github.com/hyperledger-labs/fabric-token-sdk/token/driver"
// AuditorCheck verifies if the passed tokenRequest matches the tokenRequestMetadata
// fabtoken does not make use of AuditorCheck as the token reque... |
91531713edae433ca142eb75cf912c872e61e4c2 | 4c1fa93f02aa0d47a6be412c75b50934cd9c6e9d | Battleroid/mumbledj | /commands/toggleshuffle_test.go | Go | go | 2,073 | permissive | /*
* MumbleDJ
* By Matthieu Grieger
* commands/toggleshuffle_test.go
* Copyright (c) 2016 Matthieu Grieger (MIT License)
*/
package commands
import (
"testing"
"github.com/RichardNysater/mumbledj/bot"
"github.com/spf13/viper"
"github.com/stretchr/testify/suite"
)
type ToggleShuffleCommandTestSuite struct {... |
0e7e5fb84efddd620f17acf5fe99597fbd1ab4eb | 06033c40e2dea47d4b3d40f62ed3fd15cf63b652 | pubgo/catdog | /plugins/catdog_server/default.go | Go | go | 222 | permissive | package catdog_server
import (
"context"
grpcS "github.com/asim/nitro-plugins/server/grpc/v3"
"github.com/asim/nitro/v3/server"
)
var Default = &wrapper{Server: grpcS.NewServer(server.Context(context.Background()))}
|
70ee881173b56f8fa0bc47bd100bd768ed87d035 | 506f007f8d17546559cb34e1a9c00ecaa0f4a877 | rodrwan/depto | /cmd/rest/items/context.go | Go | go | 2,542 | no_license | package items
import (
"context"
"fmt"
"log"
"net/http"
"time"
"github.com/baggyapp/depto/pkg/errors"
"github.com/baggyapp/depto/pkg/responses"
"github.com/baggyapp/depto/pkg/router"
"github.com/baggyapp/depto/services"
"github.com/sirupsen/logrus"
)
// NewRouter ...
func NewRouter(c Context) http.Handler ... |
e20ddd560b27d4f33b354d9c68d73da0a841f087 | acd42227b94033f4115bd1ca6fd4a7ce0578d4a0 | kubernetes/test-infra | /prow/cmd/phaino/main.go | Go | go | 7,092 | permissive | /*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
a6a1cdf9992c3fdcffd15e2f746966e0381b6851 | 57fe049befc3b46e3ee07e49d598a45336861372 | iwannay/bfe | /bfe_http2/server_test.go | Go | go | 83,333 | permissive | // Copyright (c) 2019 The BFE 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 agre... |
799e6e69584f98b276d70cd104ef5533fb7d66cc | 751977fd401721d1f839d76448a3e407cebc8c47 | willmtemple/origin | /pkg/template/api/v1/conversion_generated.go | Go | go | 3,456 | permissive | // +build !ignore_autogenerated_openshift
// This file was autogenerated by conversion-gen. Do not edit it manually!
package v1
import (
template_api "github.com/openshift/origin/pkg/template/api"
api "k8s.io/kubernetes/pkg/api"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func init() {
if err := api.Scheme.... |
9c136e72751f1b8c682dcc52db5179dd7aa93073 | 41d2308a5a0b42e4df81c064cb05665da04c0a01 | kri5ti/Session1 | /12.readers/readers.go | Go | go | 599 | no_license | package readers
import (
"io"
"strings"
)
// Combine returns an io.Reader which represents
// the contents of a and b.
func Combine(a, b io.Reader) io.Reader {
return io.MultiReader(a, b)
}
// always reader always fills the read buffer with
// the byte ch.
type alwaysReader struct {
ch byte
}
func (a *alwaysRea... |
75cda81a21d897c46e21d45ad05874387effdf8f | 91a1cf1f68101faac56df61e1c80a1e0e159f138 | VibrentHealth/keycloak-operator | /pkg/controller/keycloak/keycloak_controller.go | Go | go | 9,531 | permissive | package keycloak
import (
"context"
"fmt"
"time"
"github.com/keycloak/keycloak-operator/version"
v1beta12 "k8s.io/api/policy/v1beta1"
"github.com/keycloak/keycloak-operator/pkg/model"
"k8s.io/client-go/tools/record"
"sigs.k8s.io/controller-runtime/pkg/controller"
monitoringv1 "github.com/coreos/prometheu... |
8be000b85454bff5fe6cd930e26a9e9645bd9346 | 03d8c80df6a18bd2c58490e8ea01fe0426eb56ad | open-telemetry/opentelemetry-operator | /pkg/collector/reconcile/configmap_test.go | Go | go | 6,298 | permissive | // Copyright The OpenTelemetry 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 agre... |
a6097b008197cc90c0fa360bc47d1d9416d02641 | e7d44d27a6c4fe77a6a4f30861b00e09473de037 | mrbarge/aoc2019 | /day4/day4.go | Go | go | 975 | no_license | package main
import (
"fmt"
"strconv"
)
func tests(n int, partOne bool) bool {
adjacentFound := false
sNum := strconv.Itoa(n)
countAdjacent := 0
lastNum := -1
for i := 0; i < int(len(sNum)); i++ {
// test for increasing digits
if i < len(sNum)-1 && sNum[i+1] < sNum[i] {
return false
}
if lastNum ... |
8306595d0739cab051064dc7cda484b43100cdc2 | 470415ad073bb9d0270859009f5758147754c01e | zhangsongdmk/matrixone | /pkg/sql/colexec/order/order.go | Go | go | 2,727 | permissive | // Copyright 2021 Matrix Origin
//
// 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 ... |
feca6e68f68fb4aff2dc42d0773cebd271041aca | 18242b5ffd04bc7f2055a887bbbf65229c92e765 | ebfe/gapstone | /arm_constants.go | Go | go | 10,877 | permissive | package gapstone
const (
// Shifters
ARM_SFT_INVALID = iota
ARM_SFT_ASR // shift with immediate const
ARM_SFT_LSL // shift with immediate const
ARM_SFT_LSR // shift with immediate const
ARM_SFT_ROR // shift with immediate const
ARM_SFT_RRX // shift with immediate const
ARM_SFT_ASR_REG // sh... |
dc66198e0687a7d16257d9f55e6a03df25cd2afb | 1c844167676c74e6f29436460ed4aeaec60ec512 | qinxiongzhou/easegress | /pkg/object/meshcontroller/registrycenter/registry.go | Go | go | 6,778 | permissive | /*
* Copyright (c) 2017, MegaEase
* 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 ap... |
1192d90a6d45308b73790c08084b6e7e74928f5f | b12c9ebd42f0a7e04598e40abbe97e5fdbbd6d81 | deanlj/TLSHandshakeDecoder | /DecodeHandshake.go | Go | go | 2,186 | permissive | package TLSHandshakeDecoder
import (
_ "bytes"
"errors"
"fmt"
"github.com/davecgh/go-spew/spew"
)
type TLSHandshake struct {
HandshakeType uint8
length uint32
Body []byte
}
type TLSClientHello struct {
version uint16 // 2
random [32]byte // 32
sessionid []byte // 1+v
ciphe... |
ff8129c9898429a498644e5a2fc68c9c9091a289 | 26f3444c472685ae7aa09877a78e7cf67cd774a8 | Peizhong/letsgo | /playground/webapi/gateway/middlewares/middleware.go | Go | go | 2,820 | permissive | package middlewares
import (
"context"
"net/http"
"github.com/google/uuid"
httpclient "github.com/peizhong/letsgo/pkg/http"
"github.com/peizhong/letsgo/pkg/log"
)
type key int
const (
TraceK key = iota
ReRouteK
)
type Header struct {
K, V string
}
type ReRouteInfo struct {
DestURL string
DestHeader... |
be7e3f0a4a6bb837d8786d2d7b751e79d17ea937 | 0bd302a456e9be715de850b3c0210d0e3eee66be | Emyrk/golang-misc | /bufferedchannels/control/main.go | Go | go | 2,747 | no_license | // Comparing memory usage between a struct vs a pointer in a channel
package main
import (
"bufio"
"fmt"
"os"
"runtime"
"runtime/debug"
"strconv"
"time"
// "unsafe"
"github.com/dustin/go-humanize"
"github.com/pkg/profile"
)
var _ = fmt.Sprint
var _ = time.Now()
var _ = debug.FreeOSMemory
type SmallStruct... |
5461f0a6eaf715fd16e966435c4d49e7852388f7 | f1c97b1bcf1e9c1f8bfe3fb68def1eea4a31756a | cezarsa/tsuru | /app/image/suite_test.go | Go | go | 722 | permissive | package image
import (
"testing"
"github.com/tsuru/config"
"github.com/tsuru/tsuru/db"
check "gopkg.in/check.v1"
)
func Test(t *testing.T) { check.TestingT(t) }
type S struct {
storage *db.Storage
}
var _ = check.Suite(&S{})
func (s *S) SetUpSuite(c *check.C) {
config.Set("log:disable-syslog", true)
config... |
4819278e11c2abffd84965b49eb0953ad2f32670 | 6a802d53caf1df3e3a63f45b117bb346b5fb2db1 | ltto/T | /gobox/ref/ref_test.go | Go | go | 347 | no_license | package ref
import (
"testing"
)
/**func TestClonePtr(t *testing.T) {
var s int
//value := NewSetV(reflect.TypeOf(s), reflect.ValueOf(50))
value := NewSetV(reflect.TypeOf(s), 1000)
if value.Interface() != 1000 {
t.Error("set err")
}
}**/
func TestSrcTypeVal(t *testing.T) {
var i ***int
value, i2 := SrcType... |
2bc5313cfe9ae22030af85dcdb60ccd75ed551e5 | e3ab2417f83bff146087e5e6e314471e188fb64e | covarity/echo | /pkg/runtime/config/snapshot.go | Go | go | 1,087 | no_license | package config
import (
"github.com/covarity/echo/pkg/adapter"
"github.com/gogo/protobuf/proto"
adptTmpl "github.com/covarity/echo/api/adapter/model/v1"
)
type (
// HandlerStatic configuration for compiled in adapters. Fully resolved.
HandlerStatic struct {
// Name of the Handler. Fully qualified.
Name stri... |
a303b65dd233d65809ee0cf7d5d9e480abbd26f8 | 8de12b5238f6d9bb2d062e5b7eb7acb39206df5d | adrianalonsotck/go-concurrency-patterns | /channels/channels.go | Go | go | 204 | no_license | package main
import "fmt"
func main() {
channel := make(chan string)
go func() {
channel <- "Hello The Cocktail!"
}()
fmt.Println("Waiting channel")
message := <-channel
fmt.Println(message)
}
|
23b66eee5854fcbc9223748fe5306c1140b9edf1 | 422abb19b725010764b070ba5505fdde4d987cdf | rhysd/trygo | /package.go | Go | go | 3,806 | permissive | package trygo
import (
"bufio"
"fmt"
"github.com/pkg/errors"
"go/ast"
"go/format"
"go/importer"
"go/token"
"go/types"
"io"
"os"
"path/filepath"
)
// Package represents tranlated package. It contains tokens and AST of all Go files in the package
type Package struct {
// Files is a token file set to get pos... |
8d0d8e0fed7c6c2a1a8d48104824d6da896abece | 332f55828adc1da23c9c025c40bd3372f17faf5b | KalivarapuReshma/agni | /shipper.go | Go | go | 4,622 | no_license | package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
minio "github.com/minio/minio-go"
"github.com/pkg/errors"
"github.com/prometheus/tsdb"
)
var prefix = "promblock-"
func startShipper(configFile stri... |
57b69d541897081f19af4848f40e8bca72c7acf7 | 71bbecb19073578b9b4f5b98aa446b22f6012c73 | crusttech/crust-bundle | /vendor/github.com/cortezaproject/corteza-server/compose/types/record.go | Go | go | 1,677 | permissive | package types
import (
"time"
"github.com/cortezaproject/corteza-server/internal/permissions"
)
type (
// Record is a stored row in the `record` table
Record struct {
ID uint64 `json:"recordID,string" db:"id"`
ModuleID uint64 `json:"moduleID,string" db:"module_id"`
Values RecordValueSet `json:"value... |
de08cdda618225a68d6f6a900b24dc713b2e7619 | ee24b1a637a0f953b8ffb55edd1e70ccf09600d7 | lizazacn/GoWebSSH | /gossh/lib/gin/tollbooth/limiter/limiter.go | Go | go | 15,594 | permissive | // Package limiter provides data structure to configure rate-limiter.
package limiter
import (
"net/http"
"sync"
"time"
"gossh/lib/gin/tollbooth/limiter/cache"
"gossh/lib/gin/tollbooth/limiter/rate"
)
// ExpirableOptions are options used for new limiter creation
type ExpirableOptions struct {
DefaultExpiration... |
66e13855ed16f4cab50c895134981c241dc96637 | 1015f8d3979539b333e43b13a4172f65d11c126a | normster/evergreen | /model/testutil/api.go | Go | go | 6,651 | permissive | package testutil
import (
"io/ioutil"
"github.com/evergreen-ci/evergreen"
"github.com/evergreen-ci/evergreen/db"
"github.com/evergreen-ci/evergreen/model"
"github.com/evergreen-ci/evergreen/model/build"
"github.com/evergreen-ci/evergreen/model/distro"
"github.com/evergreen-ci/evergreen/model/host"
"github.com... |
83c8f7bf701ff80d04d6a19a8007d894205931d8 | 2fdfc886db859355fa213440ff2d6b4f10f543d3 | FrenchBen/infrakit | /pkg/rpc/metadata/init.go | Go | go | 761 | permissive | package metadata
import (
logutil "github.com/docker/infrakit/pkg/log"
"github.com/docker/infrakit/pkg/plugin"
rpc "github.com/docker/infrakit/pkg/rpc/client"
"github.com/docker/infrakit/pkg/types"
)
var log = logutil.New("module", "rpc/controller")
func list(name plugin.Name, client rpc.Client, method string, p... |
b67f08e837635f14b843afe84c1bc16ce1115f04 | fdd39a3d4d1a6777be38f6f4b3ef400d44d6f93e | zhanglei/snapbits | /snapbits.go | Go | go | 5,726 | permissive | package snapbits
import (
"bufio"
"encoding/binary"
"io"
"math"
"unsafe"
"github.com/golang/snappy"
)
// Writer for writing snapbits
type Writer struct {
bw *bufio.Writer
sw *snappy.Writer
}
// NewWriter returns a new Writer
func NewWriter(w io.Writer) *Writer {
sw := snappy.NewWriter(w)
bw := bufio.NewWr... |
50c49d753fad6a3c5e22e804f5d3264452513d0f | a97213a201e05cac74d302bad55e00fb092e639a | shouliang/Development | /Go/go_learning/src/ch14/error/error_test.go | Go | go | 897 | no_license | package error_test
import (
"errors"
"testing"
)
// errors.New生成error的一个实例
var LessThanTwoError = errors.New("n should be not less than 2")
var LargerThanHundredError = errors.New("n should be not larger than 100")
func GetFibonacci(n int) ([]int, error) {
if n < 2 {
return nil, LessThanTwoError
}
if n > 100... |
c56e6aca358e793bde02606b80b2ee7bc6e9df44 | 5f4e165f01f2f8afc401a11c5c843a73822dd66a | rogervaas/diagrams2ai | /config/config.go | Go | go | 953 | permissive | package config
import (
"encoding/json"
"fmt"
"io/ioutil"
)
var (
Conf *Config
Save *SaveConfig //Just for faster access
Logger *LoggerConfig //Just for faster access
)
type SaveConfig struct {
RootDir string
}
type LoggerConfig struct {
RootDir string
}
type Config struct {
Save *SaveConfig `js... |
aa30a2740e418add2c2f399fe6e47a7886de83b0 | 2fab7f9e4596e1491777266b74c7a73a715a6b49 | yangleizhou/algorithms | /algorithms/search/interpolation_search/interpolation_search.go | Go | go | 1,256 | no_license | package search
// interpolationSearch 插值查找算法
func interpolationSearch(nums []int, target int) int {
if len(nums) == 0 {
return -1
}
low, high := 0, len(nums)-1
for low <= high {
if nums[low] == target { // 防止元素都相同 被除数为0
return low
}
if target < nums[low] || target > nums[high] { // mid 范围可能不在[0,len(nums... |
dfa3bfa206f7d8e8df088b51e7e60408151826b0 | 87e56e042eec3a557d18e859c24db28512f48932 | danielthatcher/fusebox | /node.go | Go | go | 4,217 | permissive | package fusebox
import (
"context"
"os"
"sync"
"bazil.org/fuse"
"bazil.org/fuse/fs"
)
// File represents a file in the virtualfilesystem. Reading and writing is handled
// by the ValRead and ValWrite functions, which normally read and write to an
// underlying go variable. It should be possible to read from the... |
0f5cab5c607299275278181c5df63c0c16514f57 | ae510567b714eeb27653ec5629f3c51e953da9be | qmwd2006/jfrog-cli-go | /jfrog-cli/xray/commands/offlineupdate.go | Go | go | 5,724 | permissive | package commands
import (
"encoding/json"
"errors"
"fmt"
"github.com/jfrog/jfrog-cli-go/jfrog-cli/utils/cliutils"
"github.com/jfrog/jfrog-client-go/errors/httperrors"
"github.com/jfrog/jfrog-client-go/httpclient"
"github.com/jfrog/jfrog-client-go/utils"
"github.com/jfrog/jfrog-client-go/utils/errorutils"
"git... |
6cbcd475e2806e1facd3321f4b690adc480181e2 | f06bc7f79aefc5086c3190ef8ed4b8a45f860e06 | tetrafolium/luci-gae | /filter/featureBreaker/mc.go | Go | go | 2,285 | permissive | // Copyright 2015 The LUCI 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... |
d8566cd7b1acfca1553aeff94a4726c409e95d72 | f20219333fe5d10221660528f1e6a844f383bfc3 | wo4zhuzi/htdf | /types/coin.go | Go | go | 14,963 | permissive | package types
import (
"fmt"
"regexp"
"sort"
"strings"
)
//-----------------------------------------------------------------------------
// Coin
// Coin hold some amount of one currency.
//
// CONTRACT: A coin will never hold a negative amount of any denomination.
//
// TODO: Make field members private for furth... |
c9a720d2b93610c4dc9b4027763270346b0ff83d | e1596dd70196b96aae3db52aa0ef5353f9c48669 | volgorean/basicStats | /main.go | Go | go | 339 | no_license | package main
import (
"net/http"
)
func main() {
http.HandleFunc("/", rootController)
http.Handle("/resources/", http.StripPrefix("/resources/", http.FileServer(http.Dir("resources"))))
http.ListenAndServe(":8080", nil)
}
func rootController(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "resour... |
dc5c00f9dbca64efa474b872efa9044f3715a534 | 27316d09c94e5d93fa543fd8b0f99c3935e5e6c8 | dustymabe/crc | /pkg/crc/constants/constants.go | Go | go | 5,327 | permissive | package constants
import (
"fmt"
"os"
"path/filepath"
"runtime"
"github.com/code-ready/crc/pkg/crc/version"
)
const (
DefaultName = "crc"
DefaultCPUs = 4
DefaultMemory = 9216
DefaultSSHPort = 22
DefaultSSHUser = "core"
CrcEnvPrefix = "CRC"
DefaultWebConsoleURL = "https://console-openshift-console.... |
812874caf090349f1e0892b01728435faaf28cfb | 7ec8114d34419b1739e216550d9caf75a8ddc7bb | stanxii/go-graphql-hackernews | /internal/pkg/db/mysql/mysql.go | Go | go | 761 | no_license | package database
import (
"database/sql"
_ "github.com/go-sql-driver/mysql"
"github.com/golang-migrate/migrate"
"github.com/golang-migrate/migrate/database/mysql"
_ "github.com/golang-migrate/migrate/source/file"
"log"
)
var Db *sql.DB
func InitDB() {
db, err := sql.Open("mysql", "root:dbpass@(172.17.0.2:3306... |
e24495373966f48fcb147575bb9a098a5181f61b | 918e61c55c5158a8dfa8e925b481553bac6f9be6 | vmware-tanzu/crash-diagnostics | /starlark/resources.go | Go | go | 3,079 | permissive | // Copyright (c) 2020 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package starlark
import (
"fmt"
"go.starlark.net/starlark"
"go.starlark.net/starlarkstruct"
)
// resourcesFunc is a built-in starlark function that prepares returns compute list of resources.
// Starlark format: resour... |
16ce58231671ad8ace5f4acb463a9561a3f185b5 | 74ae03dc171ef22e30f3dda0f0baf5fc7f761ca1 | andywow/golang-lessons | /lesson-calendar/tests/apiserver_helper_test.go | Go | go | 1,077 | no_license | package main
import (
"context"
"os"
"time"
"google.golang.org/grpc"
"github.com/andywow/golang-lessons/lesson-calendar/pkg/eventapi"
)
var apiServerAddress = os.Getenv("APISERVER_ADDRESS")
func init() {
if apiServerAddress == "" {
apiServerAddress = "127.0.0.1:9090"
}
}
type apiServerTestClient struct {... |
212940e75082f739ea607c8449fc02bcd3cd4920 | 5fe362d4634969ccf4fc09b5c827fdc3ab9add84 | iyut/joornal | /app/model/note.go | Go | go | 7,331 | no_license | package model
import (
"bytes"
"encoding/json"
"fmt"
"log"
"time"
"joornal/app/lib/database"
"github.com/boltdb/bolt"
"gopkg.in/mgo.v2/bson"
)
// *****************************************************************************
// Note
// *************************************************************************... |
516509268d7eafb2f2a2dfd4924bc4f04ce05faa | 1dc08bcd4b81c205737774d595a15eca7ac462b7 | salesforcedoc/force | /main.go | Go | go | 727 | permissive | package main
import (
"os"
"github.com/ForceCLI/force/command"
. "github.com/ForceCLI/force/error"
. "github.com/ForceCLI/force/lib"
)
func main() {
args := os.Args[1:]
if len(args) < 1 {
command.Usage()
}
for _, cmd := range command.Commands {
if cmd.Name() == args[0] && cmd.Run != nil {
cmd.Flag.Us... |
191f65e3eafc9281eeebd0c8c9da946820664712 | f7fa82931e3a2589ab25ffc81d0fc717b0672a23 | chitha20/k8s-config-connector | /pkg/apis/gkehub/v1beta1/gkehubfeaturemembership_types.go | Go | go | 7,254 | permissive | // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wr... |
79e108a63055aec93c084a2cb74ba9a280bd6746 | ed1967fdac05674329af8a6c31067918cdd3c793 | x8091/azure-sdk-for-go | /profiles/preview/preview/servicebus/mgmt/servicebus/models.go | Go | go | 7,245 | permissive | // +build go1.9
// Copyright 2019 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.