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 |
|---|---|---|---|---|---|---|---|---|
97f7635d81086df0e3f240bcf933c6574e58a429 | a57ffbc7ed9229d6894fad445517c275d0c3db12 | minitauros/configor | /utils.go | Go | go | 9,785 | permissive | package configor
import (
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"reflect"
"strings"
"github.com/BurntSushi/toml"
"gopkg.in/yaml.v2"
)
// UnmatchedTomlKeysError errors are returned by the Load function when
// ErrorOnUnmatchedKeys is set to true and there are unmatched keys in the inp... |
8ca60fc80f189224350be459502d194d77a5b5ee | d512d1d2721bf535d033fb63a32004462f014b40 | gguoss/lotus | /node/hello/hello.go | Go | go | 2,824 | permissive | package hello
import (
"context"
"fmt"
"go.uber.org/fx"
"github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor"
logging "github.com/ipfs/go-log"
"github.com/libp2p/go-libp2p-core/host"
inet "github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/filecoin-project/... |
31aca9863f0a756aa0605c011dbcef0b92e2ef3a | 63791cf2cd0780b349ff21f5d854873cf2c8f4d2 | gravity-protocol/mobilehound | /simul/build_test.go | Go | go | 833 | no_license | package simul
import (
"strconv"
"testing"
"mobilehound/onet/simul/platform"
)
func TestBuild(t *testing.T) {
}
func TestDepth(t *testing.T) {
testStruct := []struct{ BF, depth, hosts int }{
{1, 1, 2},
{2, 1, 3},
{3, 1, 4},
{3, 2, 13},
{4, 1, 5},
{4, 2, 21},
{5, 1, 6},
{5, 2, 31},
{5, 3, 156},... |
a26e0e6cb9e683763f73f88501cb97f4452e2016 | ae43f57b68f3ce295ab9b8c544c2a950c0acdf6e | quinn/restic | /internal/restic/lock_unix.go | Go | go | 1,124 | permissive | // +build !windows
package restic
import (
"os"
"os/user"
"strconv"
"syscall"
"github.com/quinn/restic/internal/errors"
"github.com/quinn/restic/internal/debug"
)
// uidGidInt returns uid, gid of the user as a number.
func uidGidInt(u user.User) (uid, gid uint32, err error) {
var ui, gi int64
ui, err = str... |
28151e53299ab01acc5c6729b043bff66ee23300 | 918b50efbf56898ce1ae030238ea4e5dcc98aef1 | y-yagi/til | /leetcode/add-strings/main.go | Go | go | 493 | no_license | package main
func addStrings(num1 string, num2 string) string {
answer := ""
up := false
l1 := len(num1) - 1
l2 := len(num2) - 1
for l1 > -1 || l2 > -1 {
var sum byte
if l1 > -1 {
sum += num1[l1] - '0'
}
if l2 > -1 {
sum += num2[l2] - '0'
}
if up {
sum += '1' - '0'
}
if sum > '9'-'0' ... |
46a604512606d2b53c16fff1815ef8fd58e94d3c | 37a6428f773c0289d1a9995823d751914d3082be | r10v/gowindows | /Iphlpapi.go | Go | go | 4,023 | no_license | package gowindows
import (
"fmt"
"net"
)
const (
GAA_FLAG_SKIP_UNICAST = 0x0001
GAA_FLAG_SKIP_ANYCAST = 0x0002
GAA_FLAG_SKIP_MULTICAST = 0x0004
GAA_FLAG_SKIP_DNS_SERVER = 0x0008
GAA_FLAG_INCLUDE_PREFIX = 0x0010
GAA_FLAG_SKIP_FRIENDLY_NAME ... |
a00542b25c265d0bd190c4821c31cff11206ffe9 | 5fe32c32783e47b27e8343a76aaa80d89b7a699f | markpnadey1194/gapid | /gapis/api/gles/tweaker.go | Go | go | 17,293 | permissive | // Copyright (C) 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
3062b46499da4766ffc571f6b3d2fc937a861064 | 7bff5d853d8f2a18e58f031f4a85a1dcd0708bd4 | kcampos/webhook | /Godeps/_workspace/src/github.com/adnanh/webhook/hook/hook.go | Go | go | 13,287 | permissive | package hook
import (
"crypto/hmac"
"crypto/sha1"
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"reflect"
"regexp"
"strconv"
"strings"
)
// Constants used to specify the parameter source
const (
SourceHeader string = "header"
SourceQuery string = "url"
SourcePayload string = "payl... |
a0ba414f79242ae64c1020513b3480cb9880bc9c | 9c3fbbca5e3c55755caba21226f180975a7daf9b | skytodmoon/cli | /cmd/auth.go | Go | go | 2,567 | permissive | package cmd
import (
"crypto/md5"
"encoding/hex"
"fmt"
opConfig "github.com/onepanelio/cli/config"
"github.com/onepanelio/cli/util"
"github.com/spf13/cobra"
)
var (
// ServiceAccountName is the "username" we show to the user. We look up this value in k8s
ServiceAccountName string
)
var authCmd = &cobra.Comm... |
8213ab5150f1d6b9a42098fa68eb6608c4023cb7 | 99cc1ae70ba6af815dc2bfd99624b49be479264d | overtalk/gp-server | /utils/judge/judge.go | Go | go | 1,503 | no_license | package judge
import (
"bytes"
"encoding/json"
"time"
)
type JudgeRequest struct {
Src string `json:"src"`
LanguageConfig *LangConfig `json:"language_config"`
MaxCpuTime int64 `json:"max_cpu_time"`
MaxMemory int64 `json:"max_memory"`
TestCaseId st... |
ceeb3592c29c1f7366ea46222b7d0577addf5723 | 4a518b3b5a0bf4bc48260b79505c83484764e987 | jketcham/vicus | /Godeps/_workspace/src/gopkg.in/mgo.v2/bulk.go | Go | go | 6,524 | permissive | package mgo
import (
"bytes"
"github.com/jketcham/vicus/Godeps/_workspace/src/gopkg.in/mgo.v2/bson"
)
// Bulk represents an operation that can be prepared with several
// orthogonal changes before being delivered to the server.
//
// Relevant documentation:
//
// http://blog.mongodb.org/post/84922794768/mongodbs... |
e880210b8e119cce3fb3f86e3b65f7c76483f408 | 52b7e487f84560c69d209aab74ea60a4f34e8a15 | fanju1984/ddb | /Fall_2020/CourseProjects/Team2/iddb/pkg/mod/go.etcd.io/etcd@v0.5.0-alpha.5/etcdserver/etcdhttp/httptypes/errors_test.go | Go | go | 1,330 | permissive | /*
Copyright 2014 CoreOS, 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 wr... |
2c824dc2323c9365cd1f6d00914af9462d753ee9 | f919684ef39423c306090d52ce336b6065f2247e | wangqikaigit/go-demo | /studygolang/cron/main.go | Go | go | 1,895 | no_license | package main
import (
"fmt"
"github.com/robfig/cron/v3"
"time"
)
func main() {
//i := 0
//c := cron.New(
// cron.WithLogger(cron.VerbosePrintfLogger(log.New(os.Stdout, "cron ", log.Lshortfile))))
//
//_, _ = c.AddFunc("@every 30s", func() {
// i++
// fmt.Printf("task %d\n", i)
//})
//
////time.ParseDurat... |
a3b344864334f4fd4b0484c269053ff512e9d0d7 | a33ab5ba6432716432f6958e01b0eac152097545 | im-kulikov/helium | /logger/zap.go | Go | go | 3,512 | permissive | package logger
import (
"strings"
"github.com/spf13/viper"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"github.com/im-kulikov/helium/settings"
)
// Config for logger.
type Config struct {
Level string
TraceLevel string
Format string
Debug bool
Color bool
NoCaller bool
Fu... |
191e1462bccb74727607cedf48346513e05cf7f6 | bcdc6ca29b7fc19be34e2b8078ec6f3ef585ed67 | ziutek/emgo | /egpath/src/stm32/hal/raw/crc/f030x8--xgen_crc.go | Go | go | 5,932 | permissive | // +build f030x8
package crc
// DO NOT EDIT THIS FILE. GENERATED BY xgen.
import (
"bits"
"mmio"
"unsafe"
"stm32/o/f030x8/mmap"
)
type CRC_Periph struct {
DR RDR
IDR RIDR
_ uint8
_ uint16
CR RCR
_ uint32
INIT RINIT
RESERVED3 RRESERVED3
}
func (p *CRC_Pe... |
099b50dfb98eb9de34f510b47bd58cd2a2810b29 | aeeddce4bce210bd9a2033022554711d8bc02468 | clvx/go-demos | /files/src/read.go | Go | go | 1,617 | no_license | package src
import (
"fmt"
"io/ioutil"
"os"
"bufio"
"path/filepath"
"io"
)
//Reading executes a set of reading functions
func Reading(path string) {
//reading data from a file
data, err := ioutil.ReadFile(filepath.Join(path, "/data")) // returns ([]byte, err)
fmt.Println(err)
Check(err)
//converting []by... |
b1b7ca2837aa77465f0624545b7b958e2cce5a3e | 451bb24a642f32a573c35bf674451a87d94e5e18 | squ1dd13/scm | /config.go | Go | go | 3,705 | no_license | package scm
import (
_ "embed"
"fmt"
"os"
"sort"
"strconv"
"strings"
)
func readLines(path string) ([]string, error) {
fileBytes, err := os.ReadFile(path)
if err != nil {
return nil, err
}
return strings.Split(string(fileBytes), "\n"), nil
}
// Load parameter counts from an SASCM.ini file.
func LoadPro... |
7c79bd30d58a8c93fe62ee12cdc93e45a477e947 | 88de683a291cf9ad5cb2b33ee8288a462425ff07 | ninjayoto/gluetun | /internal/params/dns.go | Go | go | 6,217 | permissive | package params
import (
"fmt"
"net"
"strings"
"time"
dns "github.com/qdm12/dns/pkg/unbound"
libparams "github.com/qdm12/golibs/params"
)
// GetDNSOverTLS obtains if the DNS over TLS should be enabled
// from the environment variable DOT.
func (r *reader) GetDNSOverTLS() (DNSOverTLS bool, err error) { //nolint:... |
6ce763b8af274fea2113fabe203e28563798d0c2 | c1048e2dd89f1603ce0f66c7ffd13dab804877d6 | jbwill36/agola | /internal/services/gateway/gateway.go | Go | go | 17,269 | permissive | // Copyright 2019 Sorint.lab
//
// 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 w... |
e89debc0f035e0786e05a23c31980a78d947f626 | 2bf271e14ae34e5c1ef67ddd2ccd7028646b7b9f | wybcp/riverside | /channel/runner/runner.go | Go | go | 2,005 | no_license | package runner
//https://www.flysnow.org/2017/04/29/go-in-action-go-runner.html
import (
"errors"
"os"
"os/signal"
"time"
)
//一个执行者,可以执行任何任务,但是这些任务是限制完成的,
//该执行者可以通过发送终止信号终止它
type Runner struct {
tasks []func(int) //要执行的任务
complete chan error //用于通知任务全部完成
timeout <-chan time.Time //这些任务在多久内完成... |
54299a138208e3c26cbf55a81c176b7164749c20 | c93e918894443dc44487b1dcb89ff32789bb5a2b | xxwjj/opensds | /pkg/api/profile.go | Go | go | 7,933 | permissive | // Copyright (c) 2016 Huawei Technologies Co., Ltd. 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
... |
0a3c82ca40b45b7a9d08eb348126ae531712a1bc | 818061556056a4aafb470f6c3dc7fdb21e14404d | CosteaMihai/cloud | /server/data/sensors.go | Go | go | 1,185 | permissive | package data
import (
"fmt"
"time"
"database/sql/driver"
)
type Sensor struct {
ID int64 `db:"id"`
Key string `db:"key"`
}
type NumericWireTime time.Time
func (nw *NumericWireTime) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf("%v", time.Time(*nw).Unix()*1000)), nil
}
func (nw NumericWireTime)... |
0eca69e5aca62750f873c41e2807e4940939b539 | 729e6c2152d287952b632fe3c8ecaf49a2438a8b | coma-toast/pace-api | /pkg/provider/user/database.go | Go | go | 4,193 | no_license | package user
import (
"errors"
"fmt"
"time"
"github.com/coma-toast/pace-api/pkg/entity"
"github.com/coma-toast/pace-api/pkg/provider/firestoredb"
helper "github.com/coma-toast/pace-api/pkg/utils"
"github.com/google/uuid"
"github.com/rollbar/rollbar-go"
)
// DatabaseProvider is a user.Provider the uses a data... |
12f6496fe94b6317e1ad6b6f12ea3113798dbb2c | 2ddf7a666ae5b66d02887a32746ab86b513d8998 | pombredanne/tardisgo | /golibruntime/time/time.go | Go | go | 829 | permissive | // Package time is not implemented in TARDIS Go, this is not-fully-working TEST code, for OSX only
package time
import "github.com/tardisgo/tardisgo/tardisgolib"
// Provided by package runtime.
func now() (sec int64, nsec int32) {
return int64(tardisgolib.HAXE("GOint64.ofFloat(Date.now().getTime()/1000.0);")),
int... |
cb34ec6156972e2bac2c981b4e28435f0a0c63bd | 1032d676dbb8a5d652651bd4cfa7ee26c767a1aa | jessfraz/kubernetes | /staging/src/k8s.io/kubectl/pkg/cmd/delete/delete_test.go | Go | go | 32,837 | permissive | /*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
9b3d709efa9dc11ea8f46a822f4d076498cf6450 | 71b677e440301f4741d3ebbac57da1ffa5386dd6 | TonyXMH/goblog | /accountservice/dbclient/boltclient.go | Go | go | 1,677 | no_license | package dbclient
import (
"encoding/json"
"fmt"
"github.com/TonyXMH/goblog/accountservice/model"
"github.com/boltdb/bolt"
"log"
"strconv"
)
type IBoltClient interface {
OpenBoltDB()
QueryAccount(accountID string) (model.Account, error)
Seed()
Check()bool
}
type BoltClient struct {
boltDB *bolt.DB
}
func ... |
68cd141dac52c5694d57830e5a12b69fc6cdef39 | c660903c1e884826a4d34e91639f3190a69e4a8c | urvil38/contrib | /opa-iptables/pkg/opa/opa.go | Go | go | 2,722 | permissive | package opa
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"time"
)
const (
documentEndpointFmt = `/v1/data/%s`
)
// Error contains the standard error fields returned by OPA.
type Error struct {
Code string `json:"code"`
Message string `json:"message"`
Errors json.RawMe... |
c538a1edd64c143703a73fa9a4453ea0a364482b | 240771eda213aa61e4af9a5e75fa238e4c97dcfb | masterleros/terragrunt | /options/options.go | Go | go | 12,622 | permissive | package options
import (
"fmt"
"io"
"log"
"math"
"os"
"path/filepath"
"time"
"github.com/gruntwork-io/terragrunt/errors"
"github.com/gruntwork-io/terragrunt/util"
"github.com/hashicorp/go-version"
)
var TERRAFORM_COMMANDS_WITH_SUBCOMMAND = []string{
"debug",
"force-unlock",
"state",
}
const DEFAULT_MAX... |
b2cc601655fd66175eac3720c12f282b87f1b6e4 | 8c7839d75cb594099813e466ee855f2c904bf478 | rodolfosrd/backenfg-goland | /apis/api_persons.go | Go | go | 1,932 | no_license | package apis
import (
"net/http"
"github.com/202lp2/go2/models"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
)
//CRUD for items table
func PersonsIndex(c *gin.Context) {
var lis []models.Person
db, _ := c.Get("db")
conn := db.(gorm.DB)
conn.Find(&lis)
c.JSON(http.StatusOK, gin.H{
"msg": "thank you",
"r"... |
9dbb9a3482fdbef262df924132172cb7d055a202 | dd7a653b1b50f80259ead669430b73628dde0e61 | Yefangbiao/datastructureAndAlgorithms | /code_algorithms_introduce/chapter4/maximumsubarray.go | Go | go | 1,441 | no_license | package chapter4
import "math"
// 4.1 最大子数组问题
// 1.暴力方法
func FindMaximumSubArrayBrutal(arr []int) int {
ans := 0
for i := 0; i < len(arr)-1; i++ {
for j := i + 1; j < len(arr); j++ {
if ans < arr[j]-arr[i] {
ans = arr[j] - arr[i]
}
}
}
return ans
}
// 2.课本方法
func FindMaximumSubArray(arr []int) int... |
300772b64c0e99e5df9d3c3669e869d790ef3d6c | d3f0743687a0d73df55742197f77105d6eab18c4 | wahello/go-mall | /handler/transformer/spu.go | Go | go | 572 | no_license | package transformer
import "github.com/muxiaopie/go-mall/model"
// spu信息
type SpuTransformer struct {
Id int `json:"id"`
Name string `json:"name"`
Desc string `json:"desc"`
SellingPoint string `json:"sellingPoint"`
Unit string `json:"unit"`
BannerUrl []string `json:"bannerUrl"... |
7f9dabcaed675ef5b702e292615cce31351495db | 51bd32fafcb64114b694ffa7db7f37367df7a9dd | google/agi | /gapis/api/vulkan/transform_file_log.go | Go | go | 2,844 | permissive | // Copyright (C) 2020 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
c2776cc8d120b2e2fd5bb465d607786fdbec67e9 | 240939169f6e804deeaf35d05deae856976eab53 | aksagarwal42/WinkedInApi | /handlerFunctions/profile.go | Go | go | 757 | no_license | package handlerFunctions
import (
"encoding/json"
"net/http"
"strings"
"winkedIn/database"
"winkedIn/models"
)
func Profile(w http.ResponseWriter, r *http.Request) {
db, ctx := database.InitDB()
profileCollection := db.Collection("profile")
newUser := &models.Profile{
Name: r.FormValue("name"),
D... |
72578bef45c64cdab77dc2835792f9598104cc86 | d532ee246b8b6cbf2736d8f5e152190e72e9940a | boltlabs-inc/lnd | /watchtower/wtclient/interface.go | Go | go | 5,573 | permissive | package wtclient
import (
"net"
"github.com/btcsuite/btcd/btcec"
"github.com/lightningnetwork/lnd/brontide"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/watchtower/wtdb"
"github.com/lightningnetwork/lnd/watchtower/wtserver"
)
// DB abstra... |
b9b812752227a2c04fca14380d6d49ea594077ec | 153dbcdb4c3bf30a24d881c850030007ac78bf3e | ocdogan/fluentgo | /log/logger.go | Go | go | 6,065 | permissive | // The MIT License (MIT)
//
// Copyright (c) 2016, Cagatay Dogan
//
// 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, ... |
78bff21587a1139940273e59294d17d4aba6e98a | 753ed0c54590aa7ea4797d2cd4226652e445612f | Brickchain/k8s-deployer | /vendor/gopkg.in/src-d/go-git.v4/tree.go | Go | go | 8,659 | permissive | package git
import (
"bufio"
"errors"
"fmt"
"io"
"os"
"path"
"strconv"
"strings"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/storer"
)
const (
maxTreeDepth = 1024
startingStackSize = 8
submoduleMode = 0160000
directoryMode = 0040000
)
// New errors defined by th... |
ffa5766570db12126fabab64465918b0c0fba599 | 9eb6dd23b65b495c396f319be69d8546750aa1ef | german8890/goland | /05-02-timeouts/internal/platform/storage/mysql/course_repository_test.go | Go | go | 1,735 | no_license | package mysql
import (
"context"
"errors"
"testing"
"time"
mooc "github.com/CodelyTV/go-hexagonal_http_api-course/05-02-timeouts/internal"
"github.com/DATA-DOG/go-sqlmock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_CourseRepository_Save_RepositoryError(t *testing.T... |
8e980a7f9bcd37cefd4c249abd1971d8027de14c | dc977354c04a17bee4522b8de979e62ff9644ff5 | wnxn/gostudy | /crawler/scheduler/simple.go | Go | go | 490 | no_license | package scheduler
import "github.com/wnxn/gostudy/crawler/engine"
type SimpleScheduler struct{
workerChan chan engine.Request
}
func (s *SimpleScheduler) WorkerChan() chan engine.Request {
return s.workerChan
}
func (s *SimpleScheduler) WorkerReady(chan engine.Request) {
}
func (s *SimpleScheduler) Run() {
s.w... |
793df77381e4b7c60b03111868f14ab8845b90e3 | 29c5aabf2f2beb557d2293e71e34c5e60c2c3849 | robustirc/robustirc | /internal/ircserver/cmd_list_test.go | Go | go | 3,102 | permissive | package ircserver
import (
"testing"
"github.com/robustirc/robustirc/internal/robust"
"gopkg.in/sorcix/irc.v2"
)
func TestList(t *testing.T) {
i, ids := stdIRCServer()
mustMatchMsg(t,
i.ProcessMessage(&robust.Message{Session: ids["secure"]}, irc.ParseMessage("LIST")),
":robustirc.net 323 sECuRE :End of LI... |
441f485cdea0ef6136bc7f351be9d44940879db6 | af0f3e23a72e3269fd5a3e71e0ec5373da731f1d | tedwon/playground | /go/go-in-action/matcher/src/search/feed.go | Go | go | 721 | permissive | package search
import (
"encoding/json"
"os"
)
const dataFile = "data/data.json"
// Feed contains information we need to process a feed
type Feed struct {
Name string `json:"site"`
URI string `json:"link"`
Type string `json:"type"`
}
// RetrieveFeeds reads and unmarshals the feed data file
func RetrieveFeeds(... |
12cc0108c816db44f284fac81fbe33554326d17f | 4d8ad9871e6f81a25ceadd0e964f47efe0d31d18 | tgraf/google-api-go-client | /datastore/v1beta1/datastore-gen.go | Go | go | 54,019 | 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 datastore provides access to the Cloud Datastore API.
//
// This package is DEPRECATED. Use package cloud.google.com/go/datastore instea... |
e92744010aae81bd95552a5f00bf592f254d8ffc | 52e3d64af8356c1b8f265e57595f0c3214df82da | 345632699/gin-study | /models/province.go | Go | go | 1,034 | permissive | package models
import "github.com/jinzhu/gorm"
type Province struct {
Model
Province string `json:"province"`
Lat string `json:"lat"`
Lng string `json:"lng"`
X int `json:"x"`
Y int `json:"y"`
Img string `json:"img"`
Name string `json:"name"`
Desc string `json:"desc... |
ae8180f140ccaae872c6fc27bcc4afab59f67630 | fc8d4779f9c654bf8164bb4ca166670705ca4a66 | go-park-mail-ru/2020_2_MVVM | /models/models/company.go | Go | go | 2,094 | no_license | package models
import (
"github.com/google/uuid"
"github.com/lib/pq"
)
type OfficialCompany struct {
ID uuid.UUID `gorm:"column:comp_id;default:uuid_generate_v4()" json:"id"`
Name string `gorm:"column:name;notnull" json:"name"`
Spheres pq.Int64Array `gorm:"column:spheres" json:"sph... |
3aa98cf7ac26efc51827fc95334c2c90203e2a2e | 91607e68fb431b55196f3d370d54d77c4094c125 | allanche/rsocket-go | /rx/flux/flux.go | Go | go | 3,394 | permissive | package flux
import (
"context"
"github.com/jjeffcaii/reactor-go/flux"
"github.com/jjeffcaii/reactor-go/scheduler"
"github.com/rsocket/rsocket-go/payload"
"github.com/rsocket/rsocket-go/rx"
)
// FnSwitchOnFirst is an alias of Func for DoSwitchOnFirst.
type FnSwitchOnFirst = func(s Signal, f Flux) Flux
// Sink ... |
3cb2b53d094b36a430029aa15a252d1a6027de1e | 920402b015874956f98d7d069942b0c57f242592 | yudaprama/iso20022 | /model/UnmatchedReason7Choice.go | Go | go | 599 | permissive | package model
// Choice of format for the statement query unmatched reason.
type UnmatchedReason7Choice struct {
// Specifies the reason why the instruction has an unmatched status.
Code *UnmatchedReason4Code `xml:"Cd"`
// Specifies the reason why the instruction has an unmatched status.
Proprietary *GenericIden... |
3e0b779416b314971b6cf08c1d20ced42be3a345 | 6b532cdaa916e7846ec3d74344286bc76805d426 | riteshmotlani/goxdcr | /service_impl/audit_service.go | Go | go | 5,161 | no_license | // Copyright (c) 2013 Couchbase, 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 writin... |
90724bea8badf8fe4c96e4814aa1b9e078524c46 | e8201a55ab6a940f54594811895b6ecd6b38f639 | siddontang/goleveldb | /leveldb/memdb/memdb.go | Go | go | 10,376 | permissive | // Copyright (c) 2012, Suryandaru Triandana <syndtr@gmail.com>
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Package memdb provides in-memory key/value database implementation.
package memdb
import (
"math/rand"
"sync"
"github... |
7a96401e2fa2482925194106026612f9e2241960 | 27dc016ee24c2d0030593223f854dc1d1ab2dfb9 | kernt/teleport | /lib/reversetunnel/seek/seek.go | Go | go | 11,248 | permissive | /*
Copyright 2019 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
0071216fc05987b4734a063af886a84d3436a850 | ec7d2272c7e39b434476e7e6fb2071c16885bab6 | triplekill/blacklight | /src/vm_state.go | Go | go | 1,107 | no_license | package main
import (
"fmt"
)
type VMstate struct {
label string // a label for error reporting
o uint64 // offset
l uint64 // total length of bc
b byte // current byte
bc []byte // all bytecode
m *Meta // meta stack
all_map map[byte]string
all_flag bool
}
func (vm *... |
f927159c4410fc5e3f49b20da3061c7805a10f58 | 8d712d22518c67192aeda11539767384b9d80cc3 | 5k3105/AM | /gfxobjects/rectangle/rectangle.go | Go | go | 4,766 | no_license | package rectangle
import (
"local/AM/gfxinterface"
"local/AM/graph"
"strconv"
"github.com/emirpasic/gods/maps/treemap"
"github.com/therecipe/qt/core"
"github.com/therecipe/qt/gui"
"github.com/therecipe/qt/widgets"
)
type Rectangle struct {
*widgets.QGraphicsItem
Type string
Node *graph.No... |
21db575a5651a778a4f801404f58f40f2017bcbd | 807d78e42cd6bb30b3b9dddb04bc8225da3e7c44 | IkezawaYuki/go-microservice | /src/api/utils/test_utils/test_utils_test.go | Go | go | 1,503 | no_license | package test_utils
import (
"fmt"
"github.com/stretchr/testify/assert"
"net/http"
"net/http/httptest"
"sync"
"testing"
)
var (
counter = 0
lock sync.Mutex
atomicCounter = AtomicInt{}
)
type AtomicInt struct {
value int
lock sync.Mutex
}
func (i *AtomicInt) Increase(){
i.lock.Lock()
defer i.lock.Unlock... |
97eb89958babb13ae7aecea31f5b011143084623 | 6a6b829ce4f8f2174a88143807980751bc7e4f70 | mitch000001/go-hbci | /swift/mt940.go | Go | go | 9,394 | permissive | package swift
import (
"bytes"
"fmt"
"math"
"strconv"
"strings"
"time"
"unicode"
"github.com/mitch000001/go-hbci/domain"
"github.com/pkg/errors"
)
// MT940 represents a S.W.I.F.T. Transaction Report
type MT940 struct {
JobReference *AlphaNumericTag
Reference *AlphaNumericTag
Account ... |
ed0fda0e929ad5c655913be44e724e585f3046d1 | 3ee9d48eb989b10d1a20602270ba97804f7adeac | orbs-network/orbs-network-go | /test/contracts/nop.go | Go | go | 562 | permissive | // Copyright 2019 the orbs-network-go authors
// This file is part of the orbs-network-go library in the Orbs project.
//
// This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
// The above notice should be included in all copies or substantial portion... |
1dd8fec7c7a516893e11442b1c581ea80dc3fda8 | 9301804b12cc09ac7770c705431f9932c595de54 | ldez/prm | /cmd/remove.go | Go | go | 2,107 | permissive | package cmd
import (
"log"
"github.com/ldez/go-git-cmd-wrapper/v2/git"
"github.com/ldez/go-git-cmd-wrapper/v2/remote"
"github.com/ldez/prm/v3/choose"
"github.com/ldez/prm/v3/config"
"github.com/ldez/prm/v3/local"
"github.com/ldez/prm/v3/types"
)
// InteractiveRemove remove PR.
func InteractiveRemove(conf *con... |
e6104277ede7ad5f0b4f703b7ecda9a67ad38660 | 609c8cdd7c3c731e71d7a06bc34a4ead24cdfd37 | standardgalactic/rel | /cmd/rel/internal/util.go | Go | go | 2,278 | permissive | package internal
import (
"fmt"
"io/ioutil"
"os"
"regexp"
"strings"
)
var (
reMigrationFile = regexp.MustCompile(`^(\d+)_([a-z_]+)\.go$`)
reGomod = regexp.MustCompile(`module\s(\S+)`)
gomod = "go.mod"
)
func getDatabaseInfo() (string, string, string) {
var adapter, driver, dsn string
swit... |
8907eb567a3ea72a490a01140510d5e3eceec230 | 5574253e1d9a3b5583ebdd9aae7ab64891e581da | sgtest/monorepo-test-3 | /kubernetes-11/pkg/api/testapi/testapi.go | Go | go | 19,805 | permissive | /*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
f8c16e35cbea87d45e001212836fae2057fe88d0 | adfeb7e05487744d8d5b490462d3209f634e7327 | fiveai/terraform-provider-artifactory | /pkg/artifactory/resource_artifactory_virtual_repository.go | Go | go | 5,661 | permissive | package artifactory
import (
"context"
"fmt"
"net/http"
"github.com/atlassian/go-artifactory/v2/artifactory"
"github.com/atlassian/go-artifactory/v2/artifactory/v1"
"github.com/hashicorp/terraform/helper/schema"
)
func resourceArtifactoryVirtualRepository() *schema.Resource {
return &schema.Resource{
Create... |
3cc30fea9c8209d169ad1a44140413ed0a598689 | 3eaf40b0c14d940e4c178d26ef4513f1c6826ffe | MichaelTJones/distance | /distance.go | Go | go | 1,732 | no_license | package distance
// Jaro and Jaro-Winkler string distance (similarity) metrics
// good background reading
// http://www.cs.cmu.edu/~wcohen/postscript/ijcai-ws-2003.pdf
func min(a, b int) int {
if a < b {
return a
}
return b
}
func max(a, b int) int {
if a > b {
return a
}
return b
}
// Compute Jaro simi... |
3339e65274f8d89fb59a5a7fcd8df2fcc0515d7e | 613c41e59e659ddcf07f57059d4ce1575d684c19 | mayasnayak/go-scm | /scm/driver/gitea/gitea.go | Go | go | 2,416 | permissive | // Copyright 2017 Drone.IO 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 gitea implements a Gitea client.
package gitea
import (
"bytes"
"context"
"encoding/json"
"errors"
"io"
"net/http"
"net/url"
"strings"
"gith... |
da93cd9427faa8cd263a5be645261f67739d1575 | 22c28837d6da3e5b2bfd6d80af5c3259ea000830 | giantswarm/kube-state-metrics-app | /integration/key/key.go | Go | go | 285 | permissive | //go:build k8srequired
// +build k8srequired
package key
func AppName() string {
return "kube-state-metrics"
}
func DefaultCatalogName() string {
return "default"
}
func DefaultTestCatalogName() string {
return "default-test"
}
func Namespace() string {
return "giantswarm"
}
|
15bee5f3b80519aca147917adb999a1be450ad80 | ba7308e8549584ad68b277f043c6cce5e4d62b0b | mnovicio/golang-exercises | /pallindrome/main.go | Go | go | 461 | no_license | package main
import "fmt"
func isPallindrome(s string) bool {
if len(s) < 1 {
return false
} else if len(s) == 1 {
return true
}
for i := 0; i <= len(s)/2; i++ {
if s[i] != s[(len(s)-1)-i] {
return false
}
}
return true
}
func main() {
fmt.Println("isPallindrome(\"anna\") = ", isPallindrome("ann... |
09c4597c17328e26696b0a9112cc9052ca998e32 | 666dc4d73ed532ef188a4563e68e7449b7f64456 | cdy1996/go-demo | /src/leetcode/s/trieTree.go | Go | go | 1,981 | no_license | package s
import "strings"
// 字典树
type TrieNode struct {
Val rune
End int
Nodes []*TrieNode
}
func Insert(val string, index int, root *TrieNode) {
runes := []rune(val)
temp := root
for i := 0; i < len(val); i++ {
u := runes[i]
if temp.Nodes == nil {
nodes := make([]*TrieNode, 0)
temp.Nodes = node... |
319b54d5c5107b5ec5e974bc9a1ed9bd2e532309 | 7d1e38b39c35b651c986f8eb0882463c295c3b4d | Rnoadm/Rnoadm-Legacy | /static.go | Go | go | 3,008 | permissive | package main
import (
"bytes"
"compress/gzip"
"github.com/Rnoadm/Rnoadm-Legacy/resource"
"log"
"net/http"
"strconv"
"strings"
"time"
)
var clientGzip []byte
func init() {
packetClientHash.ClientHash = resource.Hash["client.js"]
var buf bytes.Buffer
g, err := gzip.NewWriterLevel(&buf, gzip.BestCompression... |
75c8dd264fbaf7b8b44417479b49fc35249d0ace | 153eed1dfd905459b58c238574498cf2da19bd38 | tilakraj94/clutch | /backend/service/authn/oidc.go | Go | go | 9,957 | permissive | package authn
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"strings"
"time"
"github.com/coreos/go-oidc/v3/oidc"
"github.com/dgrijalva/jwt-go"
"github.com/google/uuid"
"golang.org/x/oauth2"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
authnmodulev1 "github.com/lyft/clutch/bac... |
c2566d9fd3609aaf374b11572603ec5d8b47b1b8 | a3da5e915521a5432e7d9da911aa1b62eac1c13f | AkihiroSuda/binctr | /vendor/github.com/coreos/go-systemd/activation/files_test.go | Go | go | 2,318 | permissive | // Copyright 2015 CoreOS, 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... |
798ca3d08c0fa64d860d14098cf7f6bc3088791a | cc0c64af07c25f59fa7415e8659614097b7b086f | mmellison/turnpike | /message.go | Go | go | 10,675 | permissive | package turnpike
// Message is a generic container for a WAMP message.
type Message interface {
MessageType() MessageType
}
type MessageType int
func (mt MessageType) New() Message {
switch mt {
case HELLO:
return new(Hello)
case WELCOME:
return new(Welcome)
case ABORT:
return new(Abort)
case CHALLENGE:
... |
0a1ba43bdfe1db04c48f65053b0dd5581d9c5859 | 1ea3cd51d95cb8ea6b4d7ee9716a8b5d856471f3 | xiaoding945/moby | /pkg/sysinfo/cgroup2_linux.go | Go | go | 4,176 | permissive | package sysinfo // import "github.com/docker/docker/pkg/sysinfo"
import (
"io/ioutil"
"os"
"path"
"strings"
cgroupsV2 "github.com/containerd/cgroups/v2"
"github.com/containerd/containerd/pkg/userns"
"github.com/opencontainers/runc/libcontainer/cgroups"
"github.com/sirupsen/logrus"
)
type infoCollectorV2 func... |
13cc2e14c85a4c07790acaded4b6ff055933c9b5 | aba6c1460d47c3d424e8c8cf809782999d505041 | kuustudio/VolcEngineRTC | /server/video_conf_control/internal/dal/redis/vc_redis/user.go | Go | go | 517 | no_license | package vc_redis
import (
"context"
"time"
"github.com/volcengine/VolcEngineRTC/server/video_conf_control/internal/dal/redis"
)
const (
TaskIDKeyPrefix = "c:vccontrol:taskid:"
taskIDKeyExpire = 24 * time.Hour
)
func GetUserIDByTaskID(ctx context.Context, taskID string) string {
userID := redis.Client.Get(ctx... |
80ae57fd7acf9d256efbe61ab796e827e91abea3 | b4f5d7e5b07398fa19b4529f38b624467f6a72ab | akensho/comp_golang | /atcoder/abc/082/a.go | Go | go | 1,233 | permissive | package main
import (
"bufio"
"fmt"
"math"
"os"
"strconv"
"strings"
)
var (
in = bufio.NewReader(os.Stdin)
out = bufio.NewWriter(os.Stdout)
MOD = 1e9 + 7
UMOD = uint64(1e9 + 7)
factorial []uint64
inverse []uint64
)
func main() {
row := intSlice()
a, b := row[0], row[1]
var x ... |
cc3af4631e62152a19ed76c191594cca92604d9a | 688ea4f07b2807c0f5a8e5e9005c32579d7741be | wzhanw/multicloud-operators-subscription | /pkg/controller/mcmhub/hub_git.go | Go | go | 20,301 | 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 a... |
6f283b1cdebbb360a00c627bca3b722aed30f7b7 | d954baa4f7c1b4818e10b987dce2621611e6947b | bdshadow/kubernetes-client-android | /kubernetes-model/vendor/k8s.io/kubernetes/pkg/apis/policy/doc.go | Go | go | 1,268 | permissive | /**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... |
d08aebf83269d890a184de2e4c69aeb98c7401ce | e28adc3c4a37c16234895d91572ed6aa8eeb78e7 | guo1017138/go-vcloud-director | /govcd/nsxv_nat_test.go | Go | go | 4,989 | permissive | // +build edge nat nsxv functional ALL
/*
* Copyright 2019 VMware, Inc. All rights reserved. Licensed under the Apache v2 License.
*/
package govcd
import (
"fmt"
"github.com/vmware/go-vcloud-director/v2/types/v56"
. "gopkg.in/check.v1"
)
func (vcd *TestVCD) Test_NsxvSnatRule(check *C) {
if vcd.config.VCD.... |
b31eff1138a8138e106a9bb08f06566951ef033d | 3ed5ebb38f8993d2d04a8b5847d58929b853d0e8 | farisjr/pokemon | /app/lib/database/supplier_test.go | Go | go | 605 | no_license | package database
// func TestRegisterSuccess(t *testing.T) {
// config.TestConfig()
// config.DB.Migrator().DropTable(&models.Users{})
// config.DB.Migrator().AutoMigrate(&models.Users{})
// user, err := RegisterSupplier(mock_user)
// if assert.NoError(t, err) {
// assert.Equal(t, "tono", user.Name)
// assert... |
1541adda243e5b9d25774c132ed7eabaa7713861 | 98e2a3c29209674814731d0789c7bb5356657474 | fpxtest/kntool | /sidecar/sidecar.go | Go | go | 3,271 | no_license | package sidecar
import (
"bytes"
"context"
"os"
"os/exec"
"strings"
"syscall"
"time"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
)
var (
devices = "eth0"
ruleNotExist = "Cannot delete qdisc with handle of zero."
ruleNotExistLowerVersion = "RTNETLINK answers: No such file or direc... |
c08703f8f46a6090916728b47219c7928a90c320 | 3f295e4aac84c7c33698d4d5ad948fbe08dd0d15 | lyft/katib | /cmd/cli/command/stop-study.go | Go | go | 2,181 | permissive | // Copyright 2018 The Kubeflow 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 agr... |
c5c7f69da46ccdc69556d9fff8da2803e17b183d | bc6beef229bf61e9e8e0b0dc065171e9b80bd296 | bai123-123/blockchain-medand-machinelearning-on-hyperledger- | /hospitalPriservice/privateService.go | Go | go | 1,066 | no_license | package hospitalPriservice
import (
"encoding/json"
"fmt"
"github.com/hyperledger/fabric-sdk-go/pkg/client/channel"
)
func (t *PrivateServiceSetup) SavePriEMR(emr EMR_pri) (string, error) {
eventID := "eventAddEmr_pri"
reg, notifier := regitserEvent(t.Client, t.ChaincodeID, eventID)
defer t.Client.UnregisterCh... |
946d4fb6360a6133056cc12e5d1df9bd9dcfc834 | d7c1ce3dc07cb192e2933dba219a61627999eab3 | warthog618/config | /value_test.go | Go | go | 12,153 | permissive | // Copyright © 2017 Kent Gibson <warthog618@gmail.com>.
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
package config_test
import (
"errors"
"strconv"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/warthog618/config"
"github.com/w... |
dcbd4b772cfeac6d3ecdbe86d26941947959e883 | 9a39baf6d655c66a39a37c9e423b10e18c492cee | sarce/open-service-broker-azure | /pkg/services/rediscache/update.go | Go | go | 324 | permissive | package rediscache
import (
"github.com/Azure/open-service-broker-azure/pkg/service"
)
func (s *serviceManager) ValidateUpdatingParameters(
updatingParameters service.UpdatingParameters,
) error {
return nil
}
func (s *serviceManager) GetUpdater(service.Plan) (service.Updater, error) {
return service.NewUpdater(... |
0f89a7829b1a220ffff6e07a658364b5e3182acf | 4cd78d70fdf4468154e0e275ee597ccaf3fe3c8b | lime008/gogs | /routes/repo/editor.go | Go | go | 15,547 | permissive | // Copyright 2016 The Gogs 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 repo
import (
"fmt"
"io/ioutil"
"net/http"
"path"
"strings"
log "gopkg.in/clog.v1"
"github.com/gogits/git-module"
"github.com/gogits/gogs/m... |
df8c138f839050a89bb5230074ef561c3c76bab7 | 3c07a6b5ed4d0e89905d954ddd1ccda69e45337e | kangata/gonotes | /models/WebhookBody.go | Go | go | 1,117 | permissive | package models
import (
"errors"
"strconv"
"strings"
"github.com/kangata/gonotes/internal/env"
)
type WebhookBody struct {
Message struct {
From struct {
ID int64 `json:"id"`
FirstName string `json:"first_name"`
} `json:"from"`
Date uint64 `json:"date"`
Text string `json:"text"`
Chat str... |
a4a5015a8b7dc55c7b6cd6ad4d93ff118ce07de6 | b39f6f77a2a70c09892f74fca22bc9f567427f83 | tharamalai/meichain | /chain/x/meicdp/util.go | Go | go | 1,820 | permissive | package meicdp
import (
"encoding/hex"
"math/big"
"github.com/tharamalai/meichain/x/meicdp/types"
)
func calculateCollateralRatio(discountedCollateralValue *big.Float, totalDebtAmount *big.Float) *big.Float {
toPercent := new(big.Float).SetFloat64(100)
collateralRatio := new(big.Float)
collateralRatio.Quo(dis... |
1387e574a0f09dd162a117cf3ac31600b4bba7fb | 09011c13b0f9f2a97b3a58e58d4887e70b3f9c49 | davidhtims/gowebapp | /controller/index.go | Go | go | 554 | permissive | package controller
import (
"net/http"
"github.com/josephspurrier/gowebapp/shared/session"
"github.com/josephspurrier/gowebapp/shared/view"
)
// Displays the default home page
func Index(w http.ResponseWriter, r *http.Request) {
// Get session
session := session.Instance(r)
if session.Values["id"] != nil {
... |
1b9a7dd66270030eb908d9e2e7cd8f0c71e503fb | 58baf5afcaee1fc412bde9bae8009325384b0d3b | 4afS/cli-clean-architecture | /interface/controller/user_controller.go | Go | go | 813 | no_license | package controller
import (
"github.com/4afS/cli-clean-architecture/domain/model"
"github.com/4afS/cli-clean-architecture/usecase"
)
type UserController struct {
usecase.UserInteractor
}
func NewUserController(repo usecase.UserRepository) *UserController {
return &UserController{
UserInteractor: usecase.UserIn... |
6ed7970c9386e8c20c8e78f0d0c111c2c0e6100d | 87bc66e6148904bea72c66fa5a7ec0feda5dde76 | Semapho/lotgo-browser | /app/v1/wallet/controller/index.go | Go | go | 4,406 | no_license | package controller
import (
"github.com/gin-gonic/gin"
"main.go/app/v1/index/model/BlocksModel"
"main.go/app/v1/index/model/MessageBlsModel"
"main.go/app/v1/wallet/model/WalletUserModel"
"main.go/extend/Filecoin"
"main.go/tuuz/Calc"
"main.go/tuuz/Input"
"main.go/tuuz/RET"
)
func IndexController(route *gin.Rou... |
eb694b29c7c40c078c3bfe09847f679aae6c546c | 0f35973651e3771e9ba5eb9dd9b10622555748b6 | fcoolish/grafana | /pkg/util/ip_address.go | Go | go | 2,067 | permissive | package util
import (
"fmt"
"net"
"strings"
"github.com/grafana/grafana/pkg/util/errutil"
)
// ParseIPAddress parses an IP address and removes port and/or IPV6 format
func ParseIPAddress(input string) (string, error) {
addr, err := SplitHostPort(input)
if err != nil {
return "", errutil.Wrapf(err, "failed to... |
69bb033f73d8c390ba74a621d092032d7ffe0d40 | 897422afc59aabfd8532c57846dbc1a33d0f9c6b | yushizhao/hubble | /server/routine.go | Go | go | 5,740 | no_license | package server
import (
"encoding/json"
"strings"
"time"
"github.com/gomodule/redigo/redis"
"github.com/wonderivan/logger"
"github.com/yushizhao/hubble/models"
)
func UpdateFromDepth() {
for {
logger.Info("run updateFromDepth at: %s\n", time.Now())
rawKeys, err := MarketDataSource.Keys("DEPTHx*")
if e... |
fc930ce4f417f2f01cbefc3423fb6c1b9a014552 | fda92650048c583bf5bb35ba2b3d1f83de7d2890 | kyma-incubator/compass | /components/director/pkg/executor/executor.go | Go | go | 667 | permissive | package executor
import (
"context"
"time"
)
type periodic struct {
refreshPeriod time.Duration
executionFunc func(context.Context)
}
// NewPeriodic creates a periodic executor, which calls given executionFunc periodically.
func NewPeriodic(period time.Duration, executionFunc func(context.Context)) *periodic {
... |
b897b3bba2e7c941f8ac1ed2df316bc096b38fe7 | bfd87175ecfcb95eabdd3d9339e12de0e365f3a0 | Awti/gsuneido | /runtime/row_test.go | Go | go | 626 | permissive | // Copyright Suneido Software Corp. All rights reserved.
// Governed by the MIT license found in the LICENSE file.
package runtime
import (
"testing"
"github.com/apmckinlay/gsuneido/util/assert"
)
func TestGetRaw(*testing.T) {
hdr := SimpleHeader([]string{"one", "two", "two_lower!"})
var rb RecordBuilder
rb.Ad... |
ec93ff15baa1c0fe20d87f9652078ff1a0a59aa3 | 0c2db0309bb2bc371bc77f996e4a56239b462084 | IMLaoJI/go_dev | /Algorithm/Sort/HeapSort.go | Go | go | 987 | no_license | package Sort
/**
* Created by LONG on 2018/5/18.
*/
import "go_dev/Algorithm/common"
func HeapSort(arr []int) {
if arr == nil && len(arr) < 2 {
return
}
for index := range arr {
HeapInsert(arr, index)
}
var size = len(arr)
size--
common.Swap(arr, 0, size)
for size > 0 {
heapify(arr, 0, size)
size-... |
e67e3f168878af61ba081f5a44cda67e2c2825ff | 8579274d2eca2d45a556947fedc6ed4ceb5001c1 | Ljusyu/KubeOperator | /pkg/model/cluster_node.go | Go | go | 1,354 | permissive | package model
import (
"fmt"
"github.com/KubeOperator/KubeOperator/pkg/model/common"
"github.com/KubeOperator/KubeOperator/pkg/util/ssh"
"github.com/KubeOperator/kobe/api"
uuid "github.com/satori/go.uuid"
"time"
)
type ClusterNode struct {
common.BaseModel
ID string `json:"-"`
Name string `json:"... |
950f22841e52a005b6715b41740ee53169d7bf70 | 6ee73a92d29d87fd99097648f4f5244378088c52 | lpvm/adventofcode2019-go | /day01/day01_p02.go | Go | go | 577 | permissive | package main
import (
"fmt"
"io/ioutil"
"log"
"strconv"
"strings"
)
func rec(t int) int {
f := 0
for {
t = t/3 - 2
if t <= 0 {
break
}
f += t
}
return f
}
func main() {
file, err := ioutil.ReadFile("input.txt")
if err != nil {
log.Fatal(err)
}
input := strings.Split(string(file), "\n")
inp... |
50efbb653f69be06377267cab1fa7471b5142e85 | eb0588648cf9ff430449ce87b523f8f1919f42af | cf-gemfire-org/routing-api | /metrics/metrics_test.go | Go | go | 6,909 | permissive | package metrics_test
import (
"context"
"os"
"time"
"code.cloudfoundry.org/lager/lagertest"
"code.cloudfoundry.org/routing-api/db"
fake_db "code.cloudfoundry.org/routing-api/db/fakes"
. "code.cloudfoundry.org/routing-api/metrics"
fake_statsd "code.cloudfoundry.org/routing-api/metrics/fakes"
"code.cloudfoundr... |
f4178b93079cf47c1a3e60e3a2243fab56b4b8d7 | 7847a11f9b8b966c1ac324d53bd9e56c123457b9 | zwcui/baseMircoApi | /apigateway/util/mediaTools.go | Go | go | 18,879 | no_license | /*
@Time : 2019/3/4 下午4:33
@Author : zwcui
@Software: GoLand
*/
package util
import (
"net/http"
"bytes"
"io/ioutil"
"encoding/json"
"jingting_server/apigateway/models"
"errors"
"mime/multipart"
"os"
"io"
"fmt"
"strconv"
"image/jpeg"
"image"
"image/color"
"github.com/golang/freetype"
"image/draw"
"gi... |
541cb5f2c2d5aa1c11e59d46c3742d9b24dd39c4 | a1531a727ca82e2f8158f1590abc12e4b546e849 | openshift/cloud-credential-operator | /vendor/github.com/microsoftgraph/msgraph-sdk-go/rolemanagement/directory_role_assignment_schedule_requests_unified_role_assignment_schedule_request_item_request_builder.go | Go | go | 15,758 | permissive | package rolemanagement
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242 "github.com/microsoftgraph/msgraph-sdk-go/models"
ia572726a95efa92ddd544552cd950653d... |
428eb75f4ce4300a95e3c2b41cf07773c901bf31 | 1997980f59d9fafccad147b0b09bacaefabbdede | zhoujinlong/golang_project | /Go语言结构体/Go语言垃圾回收和SetFinalizer/1.go | Go | go | 445 | no_license | package main
import (
"log"
"runtime"
"time"
)
type Road int
func findRoad(r *Road) {
log.Println("road:", *r)
}
func entry() {
var rd Road = Road(999)
r := &rd
runtime.SetFinalizer(r, findRoad)
}
func main() {
entry()
for i := 0; i < 10; i++ {
time.Sleep(time.Second)
runtime.GC()
}
}
/**
PS D:\goLa... |
60608b84412793b5c2a42d0e52d89c948fcdaf86 | d3795723afce209eba3431858a345fe8ee74127b | wangbinzero/auto-bot | /model/binance.go | Go | go | 2,129 | no_license | package model
// Binance base response
type BinanceBaseResponse struct {
Type string `json:"e"` //事件类型
EventTime int64 `json:"E"` //事件时间
Symbol string `json:"s"` //交易对
}
// Binance detail response
type BinanceTickerResponse struct {
BinanceBaseResponse
BinanceTicker
}
// Binance kline response
type Bin... |
92bc4ff71f3376c828da66b7aa52b156505025ea | 2bfcef2648d9c4d15a8c0d66bf98f439775bfba5 | giwayne/volantmq | /clients/session.go | Go | go | 8,876 | permissive | package clients
import (
"sync"
"time"
"github.com/VolantMQ/vlapi/mqttp"
"github.com/VolantMQ/vlapi/vlauth"
"github.com/VolantMQ/vlapi/vlpersistence"
"github.com/VolantMQ/vlapi/vlsubscriber"
"go.uber.org/zap"
"github.com/VolantMQ/volantmq/configuration"
"github.com/VolantMQ/volantmq/connection"
"github.com... |
e23e260c4d56ae5a3705aecbfc0b676198bccb1c | c12352472939466fe232ef66093bc05faa29b559 | DBarney/professor | /internal/storage/collection_test.go | Go | go | 588 | no_license | package storage
import (
"testing"
)
func TestCollection(t *testing.T) {
c := Collection{"a", 1, t, 2}
count := 0
c.Each(func(elem interface{}) { count++ })
if count != 4 {
t.Fatalf("wrong number of elements were counted")
}
onlyInts := func(elem interface{}) bool { _, ok := elem.(int); return ok }
e := c... |
ab2a464826e9d0a0516b4d03c6b7b8293235e6d8 | 20d55df1b98b451b60c5bca1f679500ddc20ab49 | orpiske/camel-k | /pkg/apis/camel/v1alpha1/kamelet_binding_types_support.go | Go | go | 5,633 | 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 use this fi... |
393da37d2a08f20432807ec28a7f9027e6334607 | 9e7378012baa2b41ee07968b1a1ef3952fc17fa7 | fandytic/example-golang-oauth2 | /controllers/google/oauth2.go | Go | go | 347 | no_license | package controllersGoogle
import (
"example-golang-oauth2/lib/google"
"github.com/astaxie/beego"
)
// Oauth2Controller Oauth2コントローラー
type Oauth2Controller struct {
beego.Controller
}
// Get 認証する
func (c *Oauth2Controller) Get() {
config := google.GetConnect()
url := config.AuthCodeURL("")
c.Redirect(url, 30... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.