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 |
|---|---|---|---|---|---|---|---|---|
c908ea30b9062aba78231c5374ae5f2f29bc6ef3 | 871c3023ff9a94732083558f8ebc85e06be3ffe4 | amibiz/pl0 | /compiler/symtab.go | Go | go | 1,906 | no_license | package compiler
import (
"fmt"
"io"
"os"
"strconv"
"text/tabwriter"
)
type class int
const (
headCls class = iota
varCls
constCls
procCls
)
func (c class) String() string {
switch c {
case varCls:
return "VAR"
case constCls:
return "CONST"
case procCls:
return "PROCEDURE"
default:
return "kin... |
c0f275246db6e32c78bec7a1cf246b9d716ef49e | 654f856e2a7da38e184a63cf35720f47965428f7 | greymonster-mm/clicktail | /httime/httime.go | Go | go | 6,254 | permissive | package httime
import (
"math"
"strconv"
"strings"
"time"
"github.com/sirupsen/logrus"
)
const (
StrftimeChar = "%"
UnixTimestampFmt = "%s(%L)?"
)
var (
// DefaultNower returns current time when called with Now() unless overridden
DefaultNower Nower = &RealNower{}
// Location defaults to UTC unless ov... |
221cf79e0e2ddb836387d50323280997032e347d | 67d609a6bdba3bec4e8132daceafa04fd5a9579d | sscqchain/go-xchain | /x/distribution/client/module_client.go | Go | go | 1,605 | permissive | package client
import (
"github.com/spf13/cobra"
amino "github.com/tendermint/go-amino"
"gitee.com/xchain/go-xchain/client"
distcli "gitee.com/xchain/go-xchain/x/distribution/client/cli"
ssdistcli "gitee.com/xchain/go-xchain/x/distribution/client/cli"
)
// ModuleClient exports all client functionality from this... |
9bc0a0a914b4d088d3f8fd86e5e0956e2c8b2532 | 6ec65c552fdcdcb20f48650850a190954bffe9ef | chinashuguo/go-zero | /example/http/post/main.go | Go | go | 1,272 | no_license | package main
import (
"flag"
"fmt"
"net/http"
"github.com/chinashuguo/go-zero/core/logx"
"github.com/chinashuguo/go-zero/core/service"
"github.com/chinashuguo/go-zero/rest"
"github.com/chinashuguo/go-zero/rest/httpx"
)
var (
port = flag.Int("port", 3333, "the port to listen")
timeout = flag.Int64("timeou... |
b5788058ba203e35da40c9353085a44a4051e7ec | 15aa73de609e194161dab9b02467d4745bdbcca1 | bdshadow/kubernetes-client-android | /kubernetes-model/vendor/github.com/openshift/origin/examples/deployment/deployment.go | Go | go | 2,029 | 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... |
3e6dfd2fac3684db866103b1884d6c9000dde652 | 9b2c6b35e1dc458a5eb0b994d2f53bdec8d1ec41 | fr34k8/httpexpect | /environment_test.go | Go | go | 11,056 | permissive | package httpexpect
import (
"fmt"
"math"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestEnvironment_Constructors(t *testing.T) {
t.Run("reporter", func(t *testing.T) {
reporter := newMockReporter(t)
env := NewEnvironment(reporter)
env.chain.assert(t, success)
})
t.Run("config", func(... |
358728ab89a3945d820d3d8e1b7a341df8ada581 | 863e7e40e0d76069b852ace03e08d88a8b6de33d | zew/go-questionnaire | /pkg/qstcp/cpfmt/special-2023-03.go | Go | go | 5,290 | permissive | package cpfmt
import (
"fmt"
"log"
"strings"
qstif "github.com/zew/go-questionnaire/pkg/qstif"
"github.com/zew/go-questionnaire/pkg/trl"
)
func selectInput(langCode, inpName, inpValue string) string {
ret := ""
if langCode == "de" {
ret = fmt.Sprintf(`
<select name="%v" type="select">
<option value="... |
1db6720897bf19b6ad85d87f1366e0b6a1412adb | 4802496e2d8b386dfc27b7f864185a7850258aab | spurin/kubefire | /pkg/util/ssh/commander.go | Go | go | 2,983 | permissive | package ssh
import (
"bytes"
"fmt"
"github.com/innobead/kubefire/pkg/util"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/ssh"
"io/ioutil"
"os"
"path/filepath"
"strings"
)
type Commander interface {
Init() error
Run(before Callback, after Callback, cmds ...string) error
Downloa... |
98efcc698565ed896f559074f10f7d974ea28504 | 1d0996d94524866cc65ce50d1a5f3cd8fcb879ee | iainaff/tinygo | /src/runtime/scheduler_coroutines.go | Go | go | 3,167 | permissive | // +build scheduler.coroutines
package runtime
// This file implements the Go scheduler using coroutines.
// A goroutine contains a whole stack. A coroutine is just a single function.
// How do we use coroutines for goroutines, then?
// * Every function that contains a blocking call (like sleep) is marked
// bl... |
bdc584bee723a7683c537c11951078aef22f78d0 | fca305eb0b5f918150f67d395b6db18d474937c6 | umitkavala/protoactor-go | /_examples/remote-routing/client/main.go | Go | go | 1,158 | permissive | package main
import (
"fmt"
"log"
"runtime"
"sync"
"time"
"remoterouting/messages"
console "github.com/AsynkronIT/goconsole"
"github.com/AsynkronIT/protoactor-go/actor"
"github.com/AsynkronIT/protoactor-go/mailbox"
"github.com/AsynkronIT/protoactor-go/remote"
"github.com/AsynkronIT/protoactor-go/router"
)... |
4c855198283ac102838e7945cd6c78f694af0eda | a0333f04697f3b4b996a531cd36fc71bb066885e | modularise/prometheus-tsdb | /tsdb/head_bench_test.go | Go | go | 1,825 | permissive | // Copyright 2018 The Prometheus 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... |
b8475f47ea3d6f32428bfa7aa996bb4d756324bc | b39d265ecf4e1cec260ebce99bd12231221e20fa | ales-blaze/aks-engine | /pkg/api/defaults-custom-cloud-profile.go | Go | go | 10,522 | permissive | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
package api
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strings"
"time"
"github.com/Azure/aks-engine/pkg/helpers"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/pkg/errors"
)
// CustomCloud... |
0acdf799c12e2029710583d4ceef6f771b83b574 | 4f19dca14a3ad5b6d839613a9f8043ab7b82108b | iegomez/loraserver | /internal/api/errors.go | Go | go | 1,140 | permissive | package api
import (
"github.com/pkg/errors"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"github.com/brocaar/loraserver/internal/downlink/data"
"github.com/brocaar/loraserver/internal/downlink/proprietary"
"github.com/brocaar/loraserver/internal/storage"
)
var errToCode = map[error]codes.Code{
dat... |
99cdad15d866653f8e6921ee2bc947811c0030b6 | b73f7cb9b5e80ffbed4cda8926527d5002971897 | chriswilliams1977/go_examples | /packages/loops/examples.go | Go | go | 2,388 | no_license | package loops
import (
"bufio"
"fmt"
"github.com/chriswilliams1977/headfirst/playground/packages/keyboard"
"math/rand"
"os"
"log"
"strconv"
"strings"
"time"
)
func OutputTest() {
//Input func moved top reusable package
//Creates use prompt. Println does \n after but Print does not skip to new cmd line
//... |
0aae4e805c33a0d4003bb35c0a5de70f28b3a397 | 5f9adef64a55290568c01562b17d3f8e77738b59 | gudqs7/mycode | /go/hello.go | Go | go | 221 | no_license | package main
import "fmt"
func main(){
// 说出来你可能不信, 这是个注释, 对 还是单行的哦
/* 这是我的第一个简单的程序(才怪呢) */
fmt.Println("Hello, world")
println("aa","aa")
}
|
ebdc4768a77835a420e82d5239e190471c7886b1 | c1bb3bfcbc17a0bba41d89e405589f64513126e6 | si458/install-wayknow | /install.go | Go | go | 3,005 | no_license | package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"os/exec"
"strings"
"syscall"
_ "./statik"
"github.com/kirsle/configdir"
"github.com/rakyll/statik/fs"
)
// go build -ldflags -H=windowsgui install.go
func logStuff(mylog string) {
if true {
log.Println(mylog)
}
}
func getAndWrite(statikF... |
4c52f7c2e757fb16115989971d396be7175d7e55 | d6549da8bce3060ecf3d827c2445a4d0d048ca90 | soulplant/jaju-running | /analysis_test.go | Go | go | 8,090 | no_license | package handlers
import (
"errors"
"fmt"
"reflect"
"testing"
"time"
strava "github.com/strava/go.strava"
context "golang.org/x/net/context"
"google.golang.org/appengine"
"google.golang.org/appengine/aetest"
)
// run creates a run activity.
func run(time time.Time, duration time.Duration, distance float64) *... |
54b990cae55a2d68d3385f1858bf235f7d4881ea | 451a95c4328ad07a9ed9f8f97ea2e31a67fdddce | ssunorz/athenz | /libs/go/zmscli/tenant.go | Go | go | 7,354 | permissive | // Copyright 2016 Yahoo Inc.
// Licensed under the terms of the Apache version 2.0 license. See LICENSE file for terms.
package zmscli
import (
"bytes"
"strings"
"time"
"github.com/AthenZ/athenz/clients/go/zms"
)
func (cli Zms) DeleteTenancy(dn string, provider string) (*string, error) {
err := cli.Zms.DeleteT... |
66f2fa9efd508780043fa58e29b7be3c12216091 | f63bbf2613a23e9e8550de8306ffb0dc300dc1a3 | fujiokayu/AtCoder | /ABC081A - Placing Marbles/main.go | Go | go | 291 | no_license | package main
import (
"fmt"
"strconv"
)
func calk() int {
var arg string
fmt.Scan(&arg)
var res int
for i := 0; i < len(arg); i++ {
i, e := strconv.Atoi(string([]rune(arg)[i : i+1]))
if e != nil {
panic(e)
}
res += i
}
return res
}
func main() {
fmt.Println(calk())
}
|
6db11ec24770a864f48f7f0b0a7fea31ca009c28 | 65ce7529565753903ef0bca5b918b7d91ee2b1dd | hirany/implicitShiritori | /data.go | Go | go | 1,429 | no_license | package main
// すでにあるかどうかの判定
func userdata(username string) bool {
if username == "cpu" {
return true
}
return false
}
func voc(username string, uservoc [][]string) {
if username == "cpu" {
uservoc[0][0] = "a"
uservoc[0][1] = "ab"
uservoc[1][0] = "b"
uservoc[1][1] = "bc"
uservoc[2][0] = "c"
uservoc[... |
d8b85b0e6a00e2841fa884c52cca31c3acaaa9f6 | 60af9e970d094e2e1893b04f7b564900450dfd2a | braiscaloto/Twittor-backend | /routers/graboTweet.go | Go | go | 780 | no_license | package routers
import (
"encoding/json"
"net/http"
"time"
"github.com/braiscaloto/Twittor-backend/bd"
"github.com/braiscaloto/Twittor-backend/models"
)
/*GraboTweet permite grabar el tweet en la base de datos */
func GraboTweet(w http.ResponseWriter, r *http.Request) {
var mensaje models.Tweet
err := json.Ne... |
026430c297c029da1f6780713dd1086bab03cb9a | 8113ad71fb579bc3211d2dde59801a76fd26500c | tkmru/tour_of_go_practice | /03_07_if_and_else/if-and-else.go | Go | go | 335 | no_license | package main
import (
"fmt"
"math"
)
func pow(x, n, lim float64) float64 {
if v := math.Pow(x, n); v < lim {
return v
} else {
fmt.Printf("%g >= %g\n", v, lim)
}
// can't use v here, though
return lim
}
func main() {
fmt.Println(
pow(3, 2, 10),
pow(3, 3... |
219a4cc950cc042e9e9bca0a6058345a9cb9e196 | 577953cf598032834c1259bfacc0cc0efe185b26 | wangchanggan/golang-web-project-framework | /src/modules/user/dao/user_dao_mongo.go | Go | go | 312 | no_license | package dao
import (
"golang-web-project-framework/src/utils/db/mongo"
)
const (
databaseName = "user"
collectionName = "user"
)
var UserDaoMgo *UserDaoMongo
type UserDaoMongo struct {
Mgo *mongo.Mgo
}
func init() {
UserDaoMgo = &UserDaoMongo{
Mgo: mongo.NewMgo(databaseName, collectionName),
}
}
|
5375ad286f8490adec425e445799108c3ccea4e9 | aebed6a1b5cd0b94f77ee12a2e1da817fdf92eec | axinoss/grafana | /pkg/services/serviceaccounts/manager/service.go | Go | go | 2,611 | permissive | package manager
import (
"context"
"github.com/grafana/grafana/pkg/api/routing"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/usagestats"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/... |
eea06e707f8624943d5a0ed9e7180d7310383de9 | 394117ecc7165854ab2e070675c582959764e82f | fkorotkov/spincycle | /job-runner/runner/factory.go | Go | go | 1,169 | permissive | // Copyright 2017-2018, Square, Inc.
package runner
import (
"github.com/square/spincycle/job"
"github.com/square/spincycle/proto"
rm "github.com/square/spincycle/request-manager"
)
// A Factory takes a proto.Job, creates a corresponding job.Job interface for
// it, and passes both to NewRunner to make a Runner.
... |
43dd045b5d3169bf9ae0fe945feabab55a8921c2 | c09731c42cbfdcbb54788ffde0539a59e29950d1 | 1920853199/fynedesk | /internal/ui/widgetpanel.go | Go | go | 6,535 | no_license | package ui
import (
"fmt"
"image/color"
"io/ioutil"
"log"
"os"
"os/exec"
"path"
"strconv"
"strings"
"time"
"fyne.io/fyne"
"fyne.io/fyne/canvas"
"fyne.io/fyne/layout"
"fyne.io/fyne/theme"
"fyne.io/fyne/widget"
"fyne.io/fynedesk"
wmtheme "fyne.io/fynedesk/theme"
)
type widgetRenderer struct {
panel ... |
72db1555fb11b2d71aa860c7443f3e2c8bda0d34 | 6f10fe36a36b92b21162288a66594c41987fd9b0 | 42School/gitea | /routers/repo/download.go | Go | go | 4,093 | permissive | // Copyright 2014 The Gogs Authors. All rights reserved.
// Copyright 2018 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 repo
import (
"fmt"
"io"
"path"
"strings"
"code.gitea.io/gitea/modules/base"
"code.g... |
be972a7e18e98f7675241954a463f3ddaa5600ab | 3f35493b4070d340452c57546da9ef36462a822a | teamFloki/hedera-sdk-go | /entity_id.go | Go | go | 3,133 | permissive | package hedera
import (
"fmt"
"github.com/pkg/errors"
"regexp"
"strconv"
)
// EntityID is an interface for various IDs of entities (Account, Contract, File, etc)
type EntityID interface {
isEntityID()
}
type parseAddressResult struct {
status int
num1 int64
num2 int64
... |
77c06a5f172ef49690e41774b40758bdeadd9e1d | 4633b0fcccf7c161519cce0b4fb3bf4d6ebd1e22 | samkenxstream/stellar-org | /xdr/transaction_envelope.go | Go | go | 4,549 | permissive | package xdr
// IsFeeBump returns true if the transaction envelope is a fee bump transctoin
func (e TransactionEnvelope) IsFeeBump() bool {
return e.Type == EnvelopeTypeEnvelopeTypeTxFeeBump
}
// FeeBumpAccount returns the account paying for the fee bump transaction
func (e TransactionEnvelope) FeeBumpAccount() Muxed... |
c4b4820f0f4f79b9a48ee9385b9222200da3901c | 6a28fd033fb6a6fcd63f38df43eb554a5ca880fb | oakmound/oak | /event/handler.go | Go | go | 716 | permissive | package event
var (
_ Handler = &Bus{}
)
// Handler represents the necessary exported functions from an event.Bus
// for use in oak internally, and thus the functions that need to be replaced
// by alternative event handlers.
type Handler interface {
Reset()
TriggerForCaller(cid CallerID, event UnsafeEventID, data... |
dcd45e358effd81c091c465ad8b68d841118b04a | 68e9d0819179c931266817e5d19ae4f036cedb7d | brianoh1979/policy-bot | /server/config.go | Go | go | 2,293 | permissive | // Copyright 2018 Palantir 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 applicable law ... |
03c75e3866be811d36cdbc1c835039c81244c1fd | 9ae606c2c88e260f476d1913e453419138a15446 | jetstack/vcert | /pkg/venafi/cloud/connector.go | Go | go | 52,291 | permissive | /*
* Copyright 2018-2022 Venafi, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed ... |
ec7c0870ad4050e4295189e1a8ad7a9d44015cad | 3acfc9d1e0b4cb71a9bd1c1c6237c55844dc456a | tldrrun/tools-xlsx-to-json | /helper.go | Go | go | 1,003 | permissive | package main
import (
"log"
"regexp"
"strings"
"github.com/pkg/errors"
"github.com/urfave/cli/v2"
)
func handleError(action cli.ActionFunc) cli.ActionFunc {
return func(c *cli.Context) error {
err := action(c)
if err != nil {
log.Fatal(err)
}
return nil
}
}
func checkRequired(action cli.ActionFunc... |
057cb8796905b5495dbe97b8bd2c1bd771e02905 | 88b009a057d47d7da08891b7d9f214074835886a | TimeerJ/Fun-Data-Structure | /02-Arrays/AmortizedTimeComplexity/array/array.go | Go | go | 3,010 | no_license | package array
import (
"fmt"
"strings"
)
type data interface{}
type Array struct {
Data []data
Size int
}
// 无参工厂函数,默认Array的容量cap=10
func New() *Array {
return &Array{
Data: make([]data, 0, 10),
Size: 0,
}
}
// 有参工厂函数,传入Array的容量cap构造Array
func NewArray(cap int) *Array {
if cap < 0 {
return New()
}... |
7728dc8913878c3a392457175c0cd06f158cd678 | ffc8e8f29a678ffe81addd488150a22c2cebb8f0 | jasonBirchall/fleet | /pkg/controllers/controllers.go | Go | go | 9,196 | permissive | package controllers
import (
"context"
"strings"
"time"
"github.com/rancher/fleet/pkg/controllers/bootstrap"
"github.com/rancher/fleet/pkg/controllers/bundle"
"github.com/rancher/fleet/pkg/controllers/cleanup"
"github.com/rancher/fleet/pkg/controllers/cluster"
"github.com/rancher/fleet/pkg/controllers/cluster... |
bb3699bed16acc91edff60bf1a07e7b73d1835f4 | 8d7ff5453599e79adf5b30491b3255b90b7ce3ed | enixdark/cluster-api | /controllers/machinehealthcheck_targets.go | Go | go | 10,685 | permissive | /*
Copyright 2020 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
7690e1b34cc4e751c83ef879bb0034d4d5818f63 | a1a7e8f2b02c4069ab8e9591bab1a969ec6fd3ae | brunoserralheiro/showroom-go-rest-api | /main/mock/mock.go | Go | go | 740 | no_license | package mock
import (
model "github.com/brunoserralheiro/showroom-go-rest-api/main/model"
)
// ===============
// mock data @todo implement DB
func MockProducts() *[]model.Product {
user0 := &model.User{
ID: "0101",
Name: "name",
Email: "email",
Rank: "seller", //master, admin, manager, ... |
979fb4f5b4d72e8c7fb3073cfdad9b3fa3595e14 | 2eb89e23a52244b4835de4593c36aa5db70bcd07 | bunji2/vulns | /cmd/cmdIndex.go | Go | go | 2,286 | no_license | // 取得した脆弱性レポートデータとキーワードとの対応表を作成する
// Usage: vulns index [verbose]
package main
import (
"io/ioutil"
"os"
"strings"
"github.com/bunji2/vulns"
"github.com/bunji2/vulns/digest"
)
const (
kwIndexFile = "index.json"
cmdIndexFmt = "vulns index [verbose]"
)
var kwd *KwData
func processIndex(a... |
21c759d344e561dafd84c8ef20d1678d94ee2240 | 414def120c5f54490142412e65e8f66f7ac69cb2 | nathwill/libpod | /libpod/container_internal.go | Go | go | 36,302 | permissive | package libpod
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"syscall"
"time"
"github.com/containers/storage"
"github.com/containers/storage/pkg/archive"
"github.com/containers/storage/pkg/chrootarchive"
"github.com/docker/docker/pkg/mount"
"github.c... |
dd0375548be0a7f17729826faea2b0b963810540 | e3dc2a2b4d54473ef217f88d22496741a40fa26f | Debyendu007/GoLangWork | /3. Map and Slices/mapExe-8.go | Go | go | 436 | no_license | package main
import "fmt"
func main() {
m := map[string][]string{
"bond_james": []string{"Shaken, not stirred", "Martinis", "Women"},
"moneypenny_miss": []string{"James Bond", "Literature", "Computer Science"},
"no_dr": []string{"Being evil", "Icce cream", "Sunsets"},
}
for k, v := range m {
... |
8a5e73f028cf51cc75565738c580c7c3289e7c08 | fd1278acc39fecd3c25ec46d61f7703f2bde229f | fossabot/leetcode-4 | /700.search-in-a-binary-search-tree_test.go | Go | go | 1,568 | no_license | /*
* @lc app=leetcode id=700 lang=golang
*
* [700] Search in a Binary Search Tree
*
* https://leetcode.com/problems/search-in-a-binary-search-tree/description/
*
* algorithms
* Easy (70.63%)
* Likes: 571
* Dislikes: 107
* Total Accepted: 121.2K
* Total Submissions: 171.6K
* Testcase Example: '[4,2,7... |
9dc6c11d541de70ccae3e054b9b49fe1e9770283 | 3f8f14a2dc2c04253f5d879e1b61fccbbc9b9da6 | sminez/acme-corp | /acorp/edit.go | Go | go | 1,287 | permissive | package acorp
import (
"fmt"
"strings"
"9fans.net/go/acme"
)
// SetCursorEOL will position the current window cursor at the end of line.
func SetCursorEOL(w *acme.Win, line int) {
w.Addr(fmt.Sprintf("%d-#1", line+1))
w.Ctl("dot=addr")
w.Ctl("show")
}
// SetCursorBOL will position the current window cursor at ... |
549268b49b5871ce35208efd955b0dda1f40fe5c | a1dd0ecd2432af2bc2452183ca07bd3c902ab1c3 | opencollective/cloud | /resource-aggregate/service/aggregate.go | Go | go | 10,783 | permissive | package service
import (
"context"
"fmt"
"google.golang.org/grpc/status"
cqrsUtils "github.com/go-ocf/cloud/resource-aggregate/cqrs"
raEvents "github.com/go-ocf/cloud/resource-aggregate/cqrs/events"
"github.com/go-ocf/cloud/resource-aggregate/pb"
cqrs "github.com/go-ocf/cqrs"
cqrsEvent "github.com/go-ocf/cqr... |
1e701089c6d78c0296f8d1940de82b33b0072943 | 451aad899bbe0e1344f7d8b0c2be32bef3d05afd | jdcloud-api/jdcloud-sdk-go | /services/cdn/apis/QueryCCProtectRules.go | Go | go | 3,777 | permissive | // Copyright 2018 JDCLOUD.COM
//
// 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 ... |
7440fa844f16da8b233e5fa7a22449fba10654e8 | 023da57ec4681501c3152cb39e308af83ff6e8ed | swayops/sway | /internal/common/limiter.go | Go | go | 800 | no_license | package common
import (
"sync"
"time"
"github.com/swayops/sway/misc"
)
type LimitSet struct {
m map[string][]int32
l sync.RWMutex
}
func NewLimitSet() *LimitSet {
c := &LimitSet{m: make(map[string][]int32)}
return c
}
func (ls *LimitSet) Set(ip string) {
ls.l.Lock()
ls.m[ip] = append(ls.m[ip], int32(time.... |
2c8cdc68729253a27c986f20ae6b8d2df1751234 | 3c87d4ba7564a8c893a8b6fe672e4a30e43b63e3 | transmutate-io/atomicswap | /cmd/swapcli/cmds/recover.go | Go | go | 3,685 | permissive | package cmds
import (
"encoding/hex"
"fmt"
"io"
"text/template"
"github.com/spf13/cobra"
"github.com/transmutate-io/atomicswap/internal/cmdutil"
"github.com/transmutate-io/atomicswap/internal/flagutil"
"github.com/transmutate-io/atomicswap/internal/flagutil/exitcodes"
"github.com/transmutate-io/atomicswap/in... |
a58068505facff97536c5c9f7d99f8e4643c2887 | b48e371835393bc3c303a7293a46cc69a7deb2f5 | devopstoday11/docker-gen | /utils.go | Go | go | 1,398 | permissive | package dockergen
import (
"bufio"
"io"
"os"
"strings"
"unicode"
)
func GetEndpoint(endpoint string) (string, error) {
defaultEndpoint := "unix:///var/run/docker.sock"
if os.Getenv("DOCKER_HOST") != "" {
defaultEndpoint = os.Getenv("DOCKER_HOST")
}
if endpoint != "" {
defaultEndpoint = endpoint
}
_, ... |
b92d7262c96378963baadce359acf1c174f7dd9b | fbbbadd76ae151724fa9e0d1fa9bd08116506f13 | arita37/aistore | /ais/s3compat/common.go | Go | go | 3,698 | permissive | // Package s3compat provides Amazon S3 compatibility layer
/*
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
*/
package s3compat
import (
"fmt"
"strconv"
"strings"
)
const (
Root = "s3"
ContentType = "application/xml"
GetContentType = "binary/octet-stream"
AcceptRanges = "bytes... |
27c93351046ad1b1e43ac46ca84aa726a2b95c91 | 5e2b8b79069acab21ebdb913d05648d4099e19c8 | spatialcurrent/go-simple-serializer | /pkg/fmt/Writer.go | Go | go | 2,527 | permissive | // =================================================================
//
// Copyright (C) 2019 Spatial Current, Inc. - All Rights Reserved
// Released as open source under the MIT License. See LICENSE file.
//
// =================================================================
package fmt
import (
"io"
"reflect"
... |
3f2edf73c2406efc2f591c68b599715f3834b86d | 1236b1f369c681b30a339b9c5f3ae29e791ce077 | chungwei/imiao | /算法/LeetCode/136-single-number.go | Go | go | 1,434 | no_license | package main
/**
136. 只出现一次的数字
给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。
说明:
你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗?
示例 1:
输入: [2,2,1]
输出: 1
示例 2:
输入: [4,1,2,1,2]
输出: 4
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/single-number
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
import "fmt"
func main() {
nums := [... |
fccf7b8d6c03cfdf430e3d04ddc1fe55f6676bdf | 3a4a922a70442006b0170021b93be5009cf42531 | lukehuang/gorse | /engine/update.go | Go | go | 3,035 | permissive | package engine
import (
"github.com/BurntSushi/toml"
"github.com/zhenghaoz/gorse/base"
"github.com/zhenghaoz/gorse/core"
"log"
)
// UpdateItemPop updates popular items for the database.
func UpdateItemPop(cacheSize int, dataSet core.DataSetInterface, db *DB) error {
log.Printf("update popular items")
items, sco... |
0f0236ccfe5645b9b0a85ba82aba94e9397f2873 | 6e818880f2a08d9732da8363e550f52f37da9ba7 | wanxingroup/fanli-merchant | /pkg/rpc/shop/get_shop_info.go | Go | go | 2,928 | no_license | package shop
import (
rpclog "dev-gitlab.wanxingrowth.com/wanxin-go-micro/base/api/rpc/utils/log"
"dev-gitlab.wanxingrowth.com/wanxin-go-micro/base/data/database"
"github.com/jinzhu/gorm"
"dev-gitlab.wanxingrowth.com/fanli/merchant/pkg/constant"
"dev-gitlab.wanxingrowth.com/fanli/merchant/pkg/model"
"dev-gitlab... |
5875d524bfbd6ae7d0e4caa0db57642ee389f9be | 27b59a6a47c1aa3215540685a7a5d26e6719f832 | tpoitras/origin | /pkg/oauth/registry/oauthauthorizetoken/strategy.go | Go | go | 2,120 | permissive | package oauthauthorizetoken
import (
"fmt"
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/generic"
"github.com/GoogleCloudPlatform/kuber... |
a3679e322254d978d71f6e2769e1ddb839c814a5 | e221cf326ca27496373acec749767afba64bf453 | MiyamonY/algorithm | /GCD/go/main.go | Go | go | 290 | no_license | // Package main provides
//
// File: main.go
// Author: ymiyamoto
//
// Created on Sun Feb 2 12:42:05 2020
//
package main
const MOD = 1e9 + 7
func gcd(n, m int) int {
if m == 0 {
return n
} else if n < m {
return gcd(n, m%n)
} else {
return gcd(m, n%m)
}
}
func main() {
}
|
3e594999debc575bb557b43f43a47cba79d2b1da | ff389bc4c537d3cfa34509e15c56426461b0717e | maxkleb/gocelery | /gocelery_test.go | Go | go | 31,459 | permissive | package gocelery
import (
"fmt"
"reflect"
"strconv"
"testing"
"time"
uuid "github.com/satori/go.uuid"
)
const TIMEOUT = 2 * time.Second
var (
redisBroker = NewRedisCeleryBroker("redis://")
redisBackend = NewRedisCeleryBackend("redis://")
amqpBroker = NewAMQPCeleryBroker("amqp://")
amqpBackend = NewAMQ... |
5bde951dfd9a8eac75fffe27e99651c35c111651 | 9d50fc43e10d948a43bad4680fbc2b3e6e004366 | orenc1/kubevirt | /tests/framework/checks/checks.go | Go | go | 1,445 | permissive | package checks
import (
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
"kubevirt.io/client-go/kubecli"
"kubevirt.io/kubevirt/tests/util"
v12 "kubevirt.io/api/core/v1"
)
func IsCPUManagerPresent(node *v1.Node) bool {
gomega.Expect(node).ToNot(gomega.BeNil())
nodeHaveCpuManagerLabel := false
for label, val... |
1b109bd6a70dc8548a8f93c134b9abdb74eae6a2 | eb16974361a81225d6ee597bc7434b7b7ed07ae3 | MiguelAGrover/golang-bootcamp-2020 | /infraestructure/datastore/db.go | Go | go | 286 | no_license | package datastore
import (
"log"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
// NewDB returns the instance of the connection to sqlite
func NewDB(dbpath string) *gorm.DB {
db, err := gorm.Open(sqlite.Open(dbpath), &gorm.Config{})
if err != nil {
log.Fatalln(err)
}
return db
}
|
1495ff3b05b003b279c0718e05a6b193119ba61b | dbf6e10613feecab07f26588113375143504c3c1 | tomgross/origin | /pkg/deploy/controller/imagechange/controller_test.go | Go | go | 12,863 | permissive | package imagechange
import (
"fmt"
"testing"
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
deployapi "github.com/openshift/origin/pkg/deploy/api"
deployapitest "github.com/openshift/origin/pkg/deploy/api/test"
imageapi "github.com/openshift/origin/pkg/image/api"
)
const (
nonDefaultNamespace = "no... |
bd67f126e8d8987753a919a535a689e94cf4944f | 56e852cdfbde7fd6a3ca00af5fa2d04006f6f8cc | huilinux/htgolang-20200919 | /homework/day09-20201121/GO3075-北京-杨博钧/remoteserver/model/params.go | Go | go | 1,019 | no_license | package model
import (
"flag"
"fmt"
)
//客户端请求参数结构体
type Params struct{
Cmd string `json:"cmd"`
Path string `json:"path"`
Src string `json:"src"`
Dest string `json:"dest"`
}
// 定义设置path函数
func (this *Params) SetPath() {
fmt.Print("请输入要操作的路径:")
var path string
fmt.Scan(&path)
this.Path = path
}
// 定义设置src和de... |
1c7cb9621e261a50d486128a11abb90f58e2f208 | 0587886756db2410e9a7f928c0d2386f8d82e5fa | yc90s/lab_6.824 | /raft/test_test.go | Go | go | 19,612 | no_license | package raft
//
// Raft tests.
//
// we will use the original test_test.go to test your code for grading.
// so, while you can modify this code to help you debug, please
// test with the original before submitting.
//
import "testing"
import "fmt"
import "time"
import "math/rand"
import "sync/atomic"
import "sync"
/... |
0b12ec1914c62bc52325146f2a03525f2eec8931 | 46d77327fbfa95928aa129c631dc9646f88c8b04 | jashwantraj92/brigade | /vendor/k8s.io/utils/mount/mount.go | Go | go | 9,442 | 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, ... |
042b3f4c76002fd10be6dcdb087a15d6a790c147 | ff4521d0f6ae6c1197f0b55a2aeb9f865197d916 | zeuxisoo/go-contix | /commands/proxy.go | Go | go | 390 | no_license | package commands
import (
"github.com/codegangsta/cli"
"github.com/zeuxisoo/go-contix/commands/proxy"
)
var CmdProxy = cli.Command{
Name: "proxy",
Usage: "A tools for you manage the proxy data",
Description: "The tools provide you to fetch or update proxy data etc",
Subcommands: []cli.Command... |
575b35a95640c805d493e279f600252a8183d570 | 8cc00448793b86026e67bdfa0bd7a261aab57a4f | StarmanMartin/codon-resarch | /complementary.go | Go | go | 2,156 | no_license | package resarch
import (
"github.com/starmanmartin/codon-resarch/ctools"
)
func (c *CodonGraph) IsSelfComplementary() {
c.PropertyOne, c.PropertyTwo = c.hasProperties()
hasComp := make([]bool, len(c.List))
c.StrongNotSelfComplementary = true
isSelfComplementary := true
for idx, val := range c.List {
if !ha... |
3ce625c0e67b2a17af0208af0f4305136a4cc831 | b76705e70fc4e3a4abde9d862be27a357f7d11bc | TzashiNorpu/Algorithm | /GolangAlgorithm/1Round/Week01/LinkedList/025/reverseKGroup_test.go | Go | go | 409 | permissive | package reverseKGroup
import (
"fmt"
"testing"
)
func TestReverseKGroup(t *testing.T) {
root := &ListNode{Val: 1}
node1 := &ListNode{Val: 2}
root.Next = node1
node2 := &ListNode{Val: 3}
node1.Next = node2
node3 := &ListNode{Val: 4}
node2.Next = node3
node4 := &ListNode{Val: 5}
node3.Next = node4
node := r... |
3fa1b514abbe80799d5b7ab9641b2d7d06756830 | 72bd0dbe0bf99e8cb0462e39aa72384ee80857e0 | MinDekwad/WebreportBackend | /services/amlo/rankingcalculatebytransaction.go | Go | go | 4,748 | no_license | package amlo
import (
"context"
"fmt"
"go-api-report2/ent"
"go-api-report2/ent/configdatecalculaterank"
"go-api-report2/ent/consumer"
"go-api-report2/ent/ranking"
"go-api-report2/ent/transactionfactor"
"go-api-report2/ent/transactionfactoritem"
"go-api-report2/model"
"time"
)
func (r AmloServ... |
32cda98f6b325460bff3bb0cad8592efae27520e | 597178cfba46c4ca7628901c728991e7d11f7b6f | obedmr/govm | /vm/vm.go | Go | go | 9,864 | permissive | package vm
import (
"bufio"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"strings"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
"github.com/govm-project/govm/engines/docker"
vmTypes "github.com/govm-pr... |
428ca7845446627967912ac9b219a6de508f5d52 | 11adc50faea655ebf4b473adafe99dfbef6ea49f | sachin-varade/vehicle-tracker | /app/chaincode/src/cc/write_ledger.go | Go | go | 9,074 | 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 f... |
7e16b5a98af5350b179d9c4fbde605e151a0ef66 | 845af655373ccef68072a5d1d3cfb716a7c58527 | The-Tensox/Erutan-go | /internal/erutan/animal.go | Go | go | 8,983 | no_license | package erutan
import (
"github.com/The-Tensox/Erutan-go/internal/cfg"
"github.com/The-Tensox/Erutan-go/internal/log"
"github.com/The-Tensox/Erutan-go/internal/mon"
"github.com/The-Tensox/Erutan-go/internal/obs"
"github.com/The-Tensox/Erutan-go/internal/utils"
"github.com/The-Tensox/octree"
"github.com/The-Tens... |
d75a5de766d2a00c4b257d2fd333dd2153ef9011 | 454db0e9bdba3b811cfa00a7ccbe394255d249ee | rntakor/mls | /ratchet-tree.go | Go | go | 16,452 | no_license | package mls
import (
"fmt"
"reflect"
"github.com/bifurcation/mint/syntax"
)
///
/// Tree hash inputs
type ParentNodeInfo struct {
PublicKey HPKEPublicKey
UnmergedLeaves []leafIndex `tls:"head=4"`
}
type ParentNodeHashInput struct {
HashType uint8
Info *ParentNodeInfo `tls:"optional"`
LeftHash []... |
e92ede6477e2208a3e05551c86f1edf3cb1f6404 | 1ae8bd78c2021c6d2fce1d662c7ac36e536069b7 | lucasefe/spotcast-poc | /src/spoty/session.go | Go | go | 1,407 | no_license | package spoty
// Session is the spotify session interface
type Session interface {
Pause() (*Result, error)
Play(string) (*Result, error)
Resume() (*Result, error)
Status() (*Result, error)
}
// FakedSession represents a spotify session that does not connect to the local client
// Useful for dev mode
type FakedSe... |
4f103c9ea24113ee5e1e7c513d4ed1f3000d0c88 | 63869704e589b1146ea367de370e050bc3eaf621 | mikeee/go | /src/cmd/link/internal/ppc64/asm.go | Go | go | 53,831 | permissive | // Inferno utils/5l/asm.c
// https://bitbucket.org/inferno-os/inferno-os/src/master/utils/5l/asm.c
//
// Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
// Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
// Portions Copyright © 1997-1999 Vita Nuova Limited
// Portions Copyright ©... |
ccea4927c6634296ed6f1bfb0513de90e6b377cf | d46b7df8337b5ed031cf26430f3cd7e82d05aa3f | TomOnTime/utfutil | /utfutil_test.go | Go | go | 3,869 | permissive | package utfutil_test
import (
"bufio"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"testing"
"github.com/TomOnTime/utfutil"
)
func TestReadFile(t *testing.T) {
expected, err := ioutil.ReadFile(filepath.Join("testdata", "calblur8.htm"))
if err != nil {
log.Fatal(err)
}
// The test files were generated ... |
47ca090047e65f9bc9edf63e3bb21870c4641571 | d92fa4c908deb7f3f900334f8f4641ea98eac46d | agaffney/crapsh | /core/cmdline/parser/parser_test.go | Go | go | 4,695 | no_license | package parser
import (
"testing"
)
type parserTestCaseFlag struct {
flag string
value bool
arg string
}
type parserTestCase struct {
input []string
options OptionSet
flags []parserTestCaseFlag
args []string
errorMsg string
}
func runTests(testCases []parserTestCase, t *testing.T) {
for _, t... |
a8822c710c5477ff8d3c55171b6864e821cadb9f | fcb027ca0664566a910e1722bb73865843129467 | zbzzbd/beego | /src/services/job_complaint/complaint_create.go | Go | go | 4,909 | no_license | package complaint
import (
"fmt"
"models"
"services/notify"
"services/progress"
"strconv"
"time"
"utils"
)
func (cp *ComplaintCreator) CreateComplian(mapComplain map[string]interface{}, user *models.User) (complainId, jobId uint, err error) {
defer func() {
if err != nil {
utils.GetLog().Error("services.... |
c1b2b753c3a4b23eee89153efe8896327fe86818 | 0e397eca5c872dd0169e8369e81675e00799575b | ljgago/adbus | /cmd/server/logout.go | Go | go | 1,102 | permissive | // Copyright © 2019 Leonardo Javier Gago <ljgago@gmail.com>
//
// 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 a... |
ecaeee527712df267231fa3722f96ca03971ac3b | 6103b4dc38b9055cc9e63823fe21e2bd4d5f1afa | rebider/Fgame | /game/zhenfa/entity/player_zhenfa_power.go | Go | go | 599 | permissive | package entity
//玩家阵法战力数据
type PlayerZhenFaPowerEntity struct {
Id int64 `gorm:"primary_key;column:id"`
PlayerId int64 `gorm:"column:playerId"`
Power int64 `gorm:"column:power"`
UpdateTime int64 `gorm:"column:updateTime"`
CreateTime int64 `gorm:"column:createTime"`
DeleteTime int64 `gorm:"column:d... |
4118a352cac5008f1cbbba6ec0519aa900a9db8b | 4fc97fceaba69238a46ba5deeefc37bfa5b88e66 | dancarter/go_intro | /number-parsing.go | Go | go | 817 | no_license | package main
import "strconv"
import "fmt"
// Parsing numbers from strings is a basic but common task
// in many programs
func main() {
p := fmt.Println
// The built-in package strconv provides the number parsing
f, _ := strconv.ParseFloat("1.234", 64)
p(f)
// For ParseInt, the 0 means infer the base fro... |
3d56a04be4ce4f5af9a65459a996d3efe8c2a3f3 | f0529df9cdd9f7681777de7d80e6dd1a01e56490 | hen6003/golaunch | /golaunch/golaunch.go | Go | go | 2,310 | permissive | package main
import (
"bufio"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/rkoesters/xdg/basedir"
"github.com/rkoesters/xdg/desktop"
)
var pipe = ""
var runMode = true
func run(path string) {
if pipe != name(path) {
return
}
terminal := "xterm"
if len(os.Args) > 1 {
tmp := os.Args[le... |
46cd27152a47c25a0a8c5c55bdfc4cb721752b53 | 1db9cdf272f022215ba733f1636dbea6ce9c84f5 | taozhang-tt/go-library | /leetcode/0122-best-time-to-buy-and-sell-stock-ii/main.go | Go | go | 1,797 | no_license | package main
import "fmt"
/*
122. 买卖股票的最佳时机 II
https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii/
题目描述
给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。
设计一个算法来计算你所能获取的最大利润。你可以尽可能地完成更多的交易(多次买卖一支股票)。
注意:你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。
示例 1:
输入: [7,1,5,3,6,4]
输出: 7
解释: 在第 2 天(股票价格 = 1)的时候买入,在第 3 天(股票价格 = 5)的时候卖... |
2bd917bddccde1d641dbf93fae8c9912b981b74c | 5f21a31fb7c232da004323cf8d2eb1f3ff2dbfd6 | yaoyaoio/kubernetes-zh | /pkg/volume/csi/csi_attacher.go | Go | go | 24,239 | permissive | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
fd369f221ef28d7d3bc14a5e873a36c4b463ff5a | 02e232832a1dd68a272290cafbd5018f1b8cc718 | kedgeproject/kedgify | /vendor/github.com/openshift/origin/cmd/service-catalog/go/src/github.com/kubernetes-incubator/service-catalog/vendor/k8s.io/kubernetes/plugin/pkg/admission/resourcequota/apis/resourcequota/v1alpha1/zz_generated.conversion.go | Go | go | 3,549 | permissive | // +build !ignore_autogenerated
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applica... |
3483562ccfd70c29a44de0606029e26bda6fc539 | 032b8334e375b45b0dde29e769e47ea89a695efa | stevenchiu30801/free5gc-stage-2 | /src/udm/logger/logger.go | Go | go | 1,886 | permissive | //+build !debug
package logger
import (
"fmt"
"os"
"runtime"
"strings"
"github.com/sirupsen/logrus"
)
var log *logrus.Logger
var AppLog *logrus.Entry
var InitLog *logrus.Entry
var Handlelog *logrus.Entry
var HttpLog *logrus.Entry
var UeauLog *logrus.Entry
var UecmLog *logrus.Entry
var SdmLog *logrus.Entry
var ... |
4d73ab2686b1351afe71eddb4e78707abd8d6900 | 235310ab2c850c464335ccc383c96595c0090f7f | zaquestion/lab | /cmd/mr_show.go | Go | go | 7,632 | permissive | package cmd
import (
"fmt"
"os"
"strings"
"github.com/MakeNowJust/heredoc/v2"
"github.com/charmbracelet/glamour"
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
gitlab "github.com/xanzy/go-gitlab"
"github.com/zaquestion/lab/internal/action"
"github.com/zaquestion/lab/internal/git"
lab "github.com/za... |
fbd6fe4a545077244297d6acd07b9877efe07834 | a7cbec8c8128e5484d43e5e9ed241c680a64ca0b | huangdehui2013/cybex-gateway | /controller/sass/crypto.go | Go | go | 2,333 | no_license | package sass
import (
"bytes"
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"reflect"
"sort"
"strconv"
"strings"
)
// SignHMACSHA256 ...
func SignHMACSHA256(data interface{}, secret string) (string, error) {
buf, err := json.Marshal(data)
if err != nil {
return "", err
}
decoder :... |
9883645a0d2428147eb1b6d43fa6dba9f8718d08 | 98f3f252fff7db500acbcb3b3d72963fea740dd5 | MisinformedDNA/pulumi-azure-nextgen | /sdk/go/azure/network/v20181001/expressRouteGateway.go | Go | go | 7,694 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20181001
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// ExpressRoute gateway resource.
type ExpressRoute... |
baf0b2d91b14f64f1f80329f70f81f1c52e5d2ff | 054b2d6015c83e9a1a55970bae838321aa5c0f97 | crombus/ocs-operator | /vendor/github.com/rook/rook/pkg/apis/rook.io/v1/types.go | Go | go | 9,388 | permissive | /*
Copyright 2018 The Rook 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 agreed ... |
9d9b65905aeed3c5f3202e03c19f59693af3e65e | eda20b0a402f623a57fe3a48f5b2e9805482ecbe | Mallekoppie/script-workflow-engine | /server/models/WorkflowStep.go | Go | go | 479 | permissive | package models
type WorkflowStep struct {
StepId int `json:"step_id"`
ScriptToExecute Script `json:"script_to_execute"`
Completed bool `json:"completed"`
InProcess bool `json:"in_process"`
Success bool `json:"success"`
M... |
3d6aa140070faf0885c4305ae599cba6e3b6e4aa | 0c43e89898b6e40a80892dce94e8888e4da2d8e0 | mowangdk/testdocker | /registry/server.go | Go | go | 592 | permissive | package registry
import (
"net/http/httptest"
"github.com/aquasecurity/testdocker/auth"
"github.com/aquasecurity/testdocker/server"
"github.com/docker/docker/api/server/router"
)
type Option struct {
Images map[string]string
Auth auth.Auth
}
func NewDockerRegistry(option Option) *httptest.Server {
var rout... |
fd769edfe12987edbff5c759f0f1c89655e9e410 | 29e88f91a3763a4be59ba34f6c4df5b6a221c75c | tetsuyaohira/atcoder-go | /src/abc085/B-KagamiMochi.go | Go | go | 382 | no_license | package main
import (
"fmt"
"sort"
)
func main() {
cnt := 0
fmt.Scan(&cnt)
var kagamis = make([]int, cnt)
for i := 0; i < cnt; i++ {
fmt.Scan(&kagamis[i])
}
sort.Sort(sort.Reverse(sort.IntSlice(kagamis)))
result := 0
var prevKagami = 101
for i := 0; i < cnt; i++ {
if kagamis[i] < prevKagami {
res... |
e08792460185ee2f0114196fb7716d03bd3197c4 | 2eef698758f4d4fb0f5db3389fcda64bb512e0cc | use-go/wsa | /wssAPI/definition.go | Go | go | 1,711 | permissive | package wssapi
import (
"container/list"
"errors"
)
//Task type of the msg
type Task interface {
Receiver() string
Type() string
}
//Msg type content of the websocket
type Msg struct {
Type string // MSG Type to handle different Event
Version string
Param1 interface{}
Param2 interface{}
Params *list.L... |
05e409a48900641b001036736fb38619c97cdc9d | 3332b643f599ce201528eda0a2e6229abd95752a | toshiykst/golang-rest-api | /app/server.go | Go | go | 386 | no_license | package main
import (
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
"github.com/toshiykst/golang-rest-api/app/handler"
i "github.com/toshiykst/golang-rest-api/app/infrastructure"
)
func main() {
e := echo.New()
db := i.NewDB()
e.Use(middleware.Logger())
e.Use(middleware.Recover())
hand... |
4ec8c5ac13a32703f6a2f8771a2b22cf45a4e0d3 | 7875aa37899db66d319f0987db85e270f0408e7b | tgruben/pilosa | /api_test.go | Go | go | 47,877 | permissive | // Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
package pilosa_test
import (
"bytes"
"context"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io"
"math"
"math/rand"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"reflect"
"sort"
"strings"
"testing"
"tim... |
222fb78f730d222aaffdf9c40c2cdfa037039d01 | f76f8a14300a4d151f96a45eb3f0640c6d32b59c | nkubala/build | /pkg/apis/build/v1alpha1/build_types_test.go | Go | go | 2,351 | permissive | /*
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
26ac537bc9f6e0019d5a7fae23b2f32a7c4b3544 | 9847ed37782df3204c5b3a3d9216648743ffd7b2 | Srinivasan1983/HerdiusEngineeringTask | /client/client.go | Go | go | 2,840 | no_license | package main
import (
"HerdiusEngineeringTask/proto"
"HerdiusEngineeringTask/trust"
"context"
"crypto"
"crypto/rsa"
"fmt"
"io"
"log"
"reflect"
"strconv"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/status"
)
func main() {
config :... |
b4f06b883c5694eedc1b16bb2af2a866183c8491 | 1d21f209184806537f2b2070ed628ad42c8b01f3 | valmac/fix | /Shared/LegPreAllocGrp_LegAllocs/componentValidation.go | Go | go | 1,361 | no_license | package LegPreAllocGrp_LegAllocs
import "bufio"
import "regexp"
// Autogenerated at , do not edit
import NestedParties2_Nested2PartyIDs "grgrbll/fix/Shared/NestedParties2_Nested2PartyIDs"
type legPreAllocGrp_LegAllocs_RegexValidator struct {
LegAllocAccount *(regexp.Regexp)
LegIndividualAllocID *(regexp.... |
d9531d3159fdd7a25ee50f856970e96d864a7fa0 | 50b9d883d55e9452ce0168ff9964f4db7b450e95 | dtylman/pictures | /indexer/db/termquery.go | Go | go | 1,239 | permissive | package db
import (
"fmt"
"github.com/dtylman/pictures/indexer/picture"
)
type TermQuery struct {
term string
exact bool
limit int
res []*picture.Index
}
const NOLIMIT = 0
func NewTermQuery(term string, exact bool, limit int) *TermQuery {
return &TermQuery{term: term, exact: exact, limit: limit}
}
func ... |
9506a5580265c1bb9d8ba3f318ea71250d87e1c8 | 69d5d861785bec193c4d8776d6269e4adbce0c26 | GoLandr/g-mlm-basic | /conf/config.go | Go | go | 1,480 | no_license | package conf
import (
"fmt"
"log"
"strconv"
"strings"
gorm "gopkg.in/jinzhu/gorm.v1"
"../model"
"github.com/shopspring/decimal"
)
const (
//Levels 层数配置
Levels = "levels"
//LevelRatioString 各级分成比例
LevelRatioString = "level%dratio"
//LevelRatioSQL 各级对应sql查询语句
LevelRatioSQL = "level%ratio"
Address = "h... |
f5487bf4f453cb5885e91d542894d9a818e40e83 | 1759d847c1e0692eee9d1aad70779c8fde63b8a0 | piengeng/redisstore | /redisstore_test.go | Go | go | 3,455 | permissive | package redisstore
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/go-redis/redis"
"github.com/gorilla/sessions"
)
var (
redisAddr = "ubuntu.home:6379"
redisAddrs = []string{
"ubuntu.home:7000", "ubuntu.home:7001", "ubuntu.home:7002",
"ubuntu.home:7003", "ubuntu.home:7004", "ubuntu.home:700... |
2fc6ce8925745492e07659de15a7248cd664ba91 | a14a698dc3add9eafd03721a8bab448788bfe91f | shin-/app | /vendor/github.com/docker/cli/kubernetes/compose/v1beta2/stack.go | Go | go | 9,963 | permissive | package v1beta2
import (
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// StackList is a list of stacks
type StackList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Items []Stack `json:"item... |
eb0d67b42873c63b0fd6a815e58e7ad15ab6c107 | 8c1ba105de15937dc3a5dfa3d406bca7c72d94a2 | torukita/go-udpgen | /cmd/server.go | Go | go | 878 | permissive | package cmd
import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/torukita/go-udpgen/server"
)
var serverCmd = &cobra.Command {
Use: "server",
Short: "Run API&Web server",
Long: `API & Web Server`,
Run: func(cmd *cobra.Command, args []string) {
addr := viper.GetString("server.listen") + ":" ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.