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 |
|---|---|---|---|---|---|---|---|---|
6f1488e23ce3237586c4dd79dc055b84707f7dd1 | 332760a72978f349d67f3a85b4a2850ffd470cf2 | tw-bc-group/fabric | /token/client/orderer_client.go | Go | go | 5,178 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package client
import (
"context"
"fmt"
tls "github.com/Hyperledger-TWGC/tjfoc-gm/gmtls"
"io"
"strings"
"github.com/hyperledger/fabric/core/comm"
"github.com/hyperledger/fabric/protos/common"
ab "github.com/hyperledger/fabric/... |
80321413a94bbac4b46831223ad350f409599b01 | 8bb94003c0c75e763393a084dd4e520b9476d423 | biglogo/tidb | /planner/cascades/transformation_rules.go | Go | go | 12,874 | permissive | // Copyright 2018 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
8d9c5f92e044d45156cf561fd0b3012f1ec655eb | 07538088db129c7291d5173d9b22ce3fffa44be7 | dakale/argo | /workflow/controller/workflowpod.go | Go | go | 18,915 | permissive | package controller
import (
"encoding/json"
"fmt"
"io"
"path"
"github.com/argoproj/argo/errors"
wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
"github.com/argoproj/argo/workflow/common"
log "github.com/sirupsen/logrus"
"github.com/valyala/fasttemplate"
apiv1 "k8s.io/api/core/v1"
apierr "k8s.io/... |
c245ab6dbd3c514f19fa29faa7a3d0543d81bad9 | abca16aea0b8cbdf8795ad001a0d1bee186a2724 | wanghe-fit2cloud/kubeapps | /pkg/helm/helm.go | Go | go | 4,312 | permissive | // Copyright 2021-2022 the Kubeapps contributors.
// SPDX-License-Identifier: Apache-2.0
package helm
import (
"bytes"
"context"
"fmt"
"os"
"strings"
"github.com/containerd/containerd/remotes"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
helmregistry "helm.sh/helm/v3/pkg/registry"
log "k8s.io/... |
389a2f403c2f80bfe9a423f27be455d615d62b24 | 5eaf5cae06de1459f470f8c15481ace2fc69608c | adilkayani/mytop100movie | /movies/handler/handler_test.go | Go | go | 1,793 | no_license | package handler
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
mocks "github.com/siampudan/mytop100movie/movies/mock"
. "github.com/smartystreets/goconvey/convey"
)
func PrepareTestContext(t *testing.T, r ... |
a47d6370154ffb11306576c5bbfb56048c3490a1 | 1a969d132de1ec8b88839f6fd880d3a7ceeab829 | inabyte/embed | /generate.go | Go | go | 16,973 | permissive | package embed
// Copyright 2020 Inabyte Inc. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE.md file.
import (
"bufio"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"text/te... |
2d0ade0352e81eea1ed58410ca4b482730edd129 | 962f0f9cc6eaab6881a210cc476fe849f7a8ebde | SMW-DNV/osm | /tests/e2e/e2e_trafficsplit_same_sa_test.go | Go | go | 8,498 | permissive | package e2e
import (
"context"
"fmt"
"sync"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
. "github.com/openservicemesh/osm/tests/framework"
)
var _ = OSMDescribe("Test TrafficSplit where each backend shares the same ... |
3126f2791469b36e35ef35549c95d330acc7dfb8 | 3553bba43e6120e8b491a91649e5767b8f10de1e | dovics/catapult | /controller/controller.go | Go | go | 386 | no_license | package controller
import (
"gopkg.in/go-playground/validator.v8"
)
// BaseController -
type BaseController struct {
validator *validator.Validate
}
// New -
func New(validator *validator.Validate) *BaseController {
return &BaseController{
validator: validator,
}
}
// Valid -
func (controller *BaseController)... |
ebb54269d1be57b8bacd396f99f4812f82b53a9f | a9296a0a41d7676dd27732b2aa608bd4f51ac860 | cisco-app-networking/etcd-operator | /pkg/apis/etcd/v1beta2/cluster.go | Go | go | 8,150 | permissive | // Copyright 2016 The etcd-operator 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... |
25ff321a4e36321e6ae4b4b28d2e0afb20a4bd4d | 5466946bcc7939531c474855da5a074a21466724 | ytsarev/podinfo | /pkg/api/server.go | Go | go | 8,540 | permissive | package api
import (
"context"
"fmt"
"github.com/swaggo/swag"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
"net/http"
_ "net/http/pprof"
"os"
"strings"
"sync/atomic"
"time"
"github.com/gorilla/mux"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/spf13/viper"
_ "github.c... |
a9323a738fa4833348e56b27865fb082380a0251 | ee0c888df4538d9370e99b51f7a676a04683ed70 | dnuffer/dpcode | /prime_factorization/go/solution.go | Go | go | 782 | no_license | package main
import "fmt"
func PrimeFactorization(n int) (results []int) {
if n == 1 {
return []int{}
}
for i := 2; i < n; i++ {
if n % i == 0 {
results = append(results, i)
n /= i
i-- // need to retry same i
}
}
results = append(results, n)
return
}
func equal(a, b []int) bool {
for i := ... |
c77a624de21b19e0b7d42c414018300b209a897c | a7dc48c15a620e1c25a2c195bed601cd312e688d | fentoncryptoshell/avalanchego | /snow/validators/manager.go | Go | go | 3,173 | permissive | // (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package validators
import (
"sync"
"github.com/ava-labs/avalanchego/ids"
)
// Manager holds the validator set of each subnet
type Manager interface {
// Set a subnet's validator set
Set(ids.ID, Set) error
// Add... |
ede3cf87cf6e2c0e74692da31e190ec5b8050c98 | d90ed59ef8f4bd9ed2db34c17798497c029ce7c4 | ctompkinson/guest-list | /handlers/guest_test.go | Go | go | 3,570 | no_license | package handlers
import (
"bytes"
"fmt"
"github.com/gorilla/mux"
"github.com/ctompkinson/guest-list/database"
"github.com/ctompkinson/guest-list/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
)
func TestHandleList... |
a03deb67da12dffaa420c95a6298a139e9fe7198 | 96fc57f6578992e649cb66d45079f63e6d5eca9a | fweingartshofer/Spongebot | /api/command_controller.go | Go | go | 1,757 | permissive | package api
import (
"errors"
"github.com/flohero/Spongebot/database/model"
"net/http"
)
// GetAllCommands takes a http.ResponseWriter and a *http.Request.
// It will write all Commands in JSON Format to writer
func (c *Controller) GetAllCommands(writer http.ResponseWriter, request *http.Request) {
cmds, err := c... |
b9e56d304988632ad9ba8e4a7e6501eacf09ce3c | 0611915450a1ecf39a56b3348f026e897cd616db | huyouhengbc/Hyperledger | /HelloWorld/HelloWorld.go | Go | go | 979 | no_license | package main
import (
"fmt"
"github.com/hyperledger/fabric/core/chaincode/shim"
)
type HelloWorldChaincode struct {
}
func (t *HelloWorldChaincode) Init(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {
fmt.Printf("HelloWorld - Init called with function %s!\n", function)
... |
d0900bcd64b73d6268f261001cdf82e309b3cfea | 9ffd3dd000170a86902b2e5c1b2118a303787cc3 | cezmunsta/skia-buildbot | /golden/go/paramsets/paramsets_test.go | Go | go | 5,388 | permissive | package paramsets
import (
"testing"
"github.com/stretchr/testify/assert"
"go.skia.org/infra/go/paramtools"
"go.skia.org/infra/go/testutils/unittest"
"go.skia.org/infra/golden/go/digest_counter"
"go.skia.org/infra/golden/go/mocks"
"go.skia.org/infra/golden/go/tiling"
"go.skia.org/infra/golden/go/types"
)
fun... |
34b474bd650e43d74ab2c5161199c8289f801665 | 3aef4407ec7c02a82d4bf7baf36f6bbd5c1a7fe7 | huaweicloud/huaweicloud-sdk-go-v3 | /services/gaussdbforopengauss/v3/model/model_allow_db_privileges_response.go | Go | go | 449 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// AllowDbPrivilegesResponse Response Object
type AllowDbPrivilegesResponse struct {
HttpStatusCode int `json:"-"`
}
func (o AllowDbPrivilegesResponse) String() string {
data, err := utils.Marshal(o)
if err != nil {
... |
6439a36ecb202163b5b0031c8cf624faa5a82ace | ea2ddb34126192529b12b4084bd762810d14bce9 | erenming/leetcode-go | /greedy/twoCitySchedCost/twoCitySchedCost_test.go | Go | go | 471 | no_license | package twoCitySchedCost
import "testing"
func Test_twoCitySchedCost(t *testing.T) {
type args struct {
costs [][]int
}
tests := []struct {
name string
args args
want int
}{
{"t-1", args{[][]int{{10, 20}, {30, 200}, {400, 50}, {30, 20}}}, 110},
}
for _, tt := range tests {
t.Run(tt.name, func(t *tes... |
48a43e0de39fd1a3f64ef0d9fb9a5719d3a9e623 | f412dcc22c1924f7d41db34e9920bb107b9c4bc6 | forkkit/gosoline | /pkg/sub/sub_out_kvstore.go | Go | go | 950 | no_license | package sub
import (
"context"
"github.com/applike/gosoline/pkg/cfg"
"github.com/applike/gosoline/pkg/kvstore"
"github.com/applike/gosoline/pkg/mon"
)
type subOutKvstore struct {
logger mon.Logger
store kvstore.KvStore
}
func (p *subOutKvstore) GetType() string {
return "kvstore"
}
func (p *subOutKvstore) B... |
576d0f273eb3bf80536a6b2bb1f4a55e4d529416 | ae5908631629534b617633f2598819d7cf8327fc | hydaizd/zdadmin | /models/oplog.go | Go | go | 685 | no_license | package models
import (
"time"
)
type OpLog struct {
OpId int `json:"op_id"` // 日志ID
OpTable string `json:"op_table"` // 操作表名(不包含前缀)
OpAction string `json:"op_action"` // 操作动作行为(create创建,update更新,delete删除,audit审查)
CommonId int `json:"menu_uri"` // 操作内容ID
Crea... |
f10f9acb1231652be8719648d3a8fb8e918e7305 | 2e94c28c4657d1e9935bf330eec5ee47b235ed39 | larsxschneider/git-lfs | /lfs/download_queue.go | Go | go | 1,342 | permissive | package lfs
import (
"github.com/github/git-lfs/api"
"github.com/github/git-lfs/transfer"
)
type Downloadable struct {
pointer *WrappedPointer
object *api.ObjectResource
}
func (d *Downloadable) Object() *api.ObjectResource {
return d.object
}
func (d *Downloadable) Oid() string {
return d.pointer.Oid
}
fun... |
60ba9b27baeb42446860d033cb3f39a502a839dc | bc0a53639f97f7c82878997053236a38acadb1d1 | doytsujin/fillin | /exec.go | Go | go | 1,613 | permissive | package main
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"
)
var cmdBase = []string{"sh", "-c"}
func init() {
if runtime.GOOS == "windows" {
cmdBase = []string{"cmd", "/c"}
}
}
// Exec fillin
func Exec() error {
if len(os.Args) >= 2 {
switch os.Args[1] {
case "-v", "version", "-version", "--... |
6774ca1f410234c791a1c7bc156688553ebf0e6a | fee6d79e4c0030713fc0469b76076f23e21ee285 | cludden/go-mysql | /canal/canal_test.go | Go | go | 4,884 | permissive | package canal
import (
"bytes"
"fmt"
"os"
"testing"
"time"
"github.com/cludden/go-mysql/mysql"
"github.com/juju/errors"
. "github.com/pingcap/check"
)
func Test(t *testing.T) {
TestingT(t)
}
type canalTestSuite struct {
c *Canal
}
var _ = Suite(&canalTestSuite{})
var addr = fmt.Sprintf("%s:%s", os.Getenv... |
8c68938cf6d5c945dd09b41af9332aacc52fba1a | c4837ad4e8a3ac462999a1e4ec90bb0f24528e08 | huaweicloud/cloudeye-exporter | /vendor/github.com/huaweicloud/golangsdk/openstack/rds/v3/instances/requests.go | Go | go | 11,038 | permissive | package instances
import (
"fmt"
"github.com/huaweicloud/golangsdk"
"github.com/huaweicloud/golangsdk/pagination"
)
type CreateRdsOpts struct {
Name string `json:"name" required:"true"`
Datastore *Datastore `json:"datastore" required:"true"`
Ha *Ha ... |
341ffa22ea0e9b5beed92d629c1158c17696c252 | 5ec88f0c9c70e9ce609c8fc9058cb0cc84a14567 | fanatic/gomaprtables | /scanner.go | Go | go | 2,914 | no_license | package gomaprtables
/*
#include <stdlib.h>
#include <string.h>
#include <hbase/hbase.h>
void sn_cb(int32_t err, hb_scanner_t scan, hb_result_t *results, size_t numResults, void *extra);
void sn_destroy_cb(int32_t err, hb_scanner_t scanner, void *extra);
*/
import "C"
import "unsafe"
import "fmt"
//Scan queues a req... |
09c3385889ee751d4e193ee476fec0d7397a3044 | 7636c46e611ecd4aee323c530710ca4d2ce77f4a | minami14/tengor | /nn/shape.go | Go | go | 914 | permissive | package nn
// Shape is a shape of a tensor.
type Shape []int
// RawIndex is a index of raw data.
func (s Shape) RawIndex(at Shape) int {
if s.Rank() != at.Rank() {
panic("invalid rank")
}
index := 0
a := 1
for i, x := range at {
if x >= s[i] {
panic("index out of range")
}
index += x * a
a *= s[i]... |
2b616bc31ad1f6c4141064d5f1c071f1424579e7 | 3f077fc3182aa772e1b5d35140373348bed2702b | redNixon/cfssl | /whitelist/example/example_whitelist.go | Go | go | 2,077 | permissive | package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"net"
"net/http"
"github.com/redNixon/cfssl/whitelist"
)
var wl = whitelist.NewBasic()
func addIP(w http.ResponseWriter, r *http.Request) {
addr := r.FormValue("ip")
ip := net.ParseIP(addr)
wl.Add(ip)
log.Printf("request to add %s to the whitelist... |
ffe3ef6cae72f8640250e0863979a2d0d4e55303 | d1aec9383c15fc76f2b9b91868d5d22243501dce | nsd20463/durationsort | /durationsort.go | Go | go | 4,870 | permissive | /*
Duration sorting.
Copyright 2018 Nicolas S. Dade
*/
package durationsort
import (
"fmt"
"sort"
"strconv"
"strings"
"time"
)
// Less returns true if x < y in a duration-aware comparison.
// It is suitable for use with Go's standard sort.Interface.
func Less(a, b string) bool {
// the idea is to scan alon... |
28db8eaa5e4bdeaf8fbc6618d73b25b7de3cbcf9 | b6e2a3a8ac89d090496a6eda1fcb6755a0f97298 | arjunpatel100/evergreen | /rest/route/annotations_test.go | Go | go | 21,544 | permissive | package route
import (
"bytes"
"context"
"encoding/json"
"net/http"
"testing"
"github.com/evergreen-ci/evergreen"
"github.com/evergreen-ci/evergreen/db"
"github.com/evergreen-ci/evergreen/model/annotations"
"github.com/evergreen-ci/evergreen/model/task"
"github.com/evergreen-ci/evergreen/model/user"
"githu... |
abc0b9017bda96837f1399166a95c9bc7d960f5d | 64387fa04ad50360097feb3aae1dcae9b03c1df2 | SunQ4X/stream_server | /web_api/web_api_server.go | Go | go | 18,481 | no_license | package web_api
import (
"encoding/json"
// "fmt"
"io/ioutil"
"logger"
"logic_proc"
"strconv"
// "media_session"
"net"
"net/http"
"protocol"
"stream"
"strings"
"time"
"utility"
"webserver"
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/mem"
//"github.com/shirou/gopsutil/net"
"net/http... |
b973e06d01fbae07d4621f7da4f68650809e80e1 | a09f6e056f73d225a7ad727b58515c2e58f6301f | jainvipin/netplugin | /netplugin/svcplugin/consulextension/consul.go | Go | go | 2,703 | permissive | package consulextension
import (
"fmt"
"net/url"
log "github.com/Sirupsen/logrus"
"github.com/contiv/netplugin/netplugin/svcplugin/bridge"
consulapi "github.com/hashicorp/consul/api"
)
// DefaultInterval time to perform health checks for services
const DefaultInterval = "10s"
// InitConsulAdapter registers as ... |
4c6c4d5e8413cc612e4c756851d31bad281d086f | 5bfceb93aa3f4eb1274fc5252f80b5123ef2ee59 | balazsprehoda/blockchain-analyzer-intermediary | /agent/fabricbeat/vendor/github.com/rogpeppe/godef/go/parser/parser.go | Go | go | 54,135 | permissive | // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// A parser for Go source files. Input may be provided in a variety of
// forms (see the various Parse* functions); the output is an abstract
// syntax tree (AS... |
1fc509d1f4cce8fc7cb83bfd9eb526fa0a9c3e09 | 20d9348d7a8614a4575cc4c6bcc4f8c320380d9d | ritazh/open-service-broker-azure | /tests/lifecycle/mssql_cases_test.go | Go | go | 6,003 | permissive | // +build !unit
package lifecycle
import (
"database/sql"
"encoding/json"
"fmt"
"net/url"
"os"
"github.com/Azure/open-service-broker-azure/pkg/azure/arm"
ss "github.com/Azure/open-service-broker-azure/pkg/azure/mssql"
"github.com/Azure/open-service-broker-azure/pkg/generate"
"github.com/Azure/open-service-b... |
d85ee819cea0ed5e669d77fe36186a247eeeed23 | 6969f9b20a1405f623ef77b656d8a9f23b39a943 | aws/amazon-vpc-cni-k8s | /pkg/hostipamwrapper/hostipam.go | Go | go | 1,815 | permissive | // Copyright Amazon.com Inc. or its affiliates. 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. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" file ... |
40a868ae55d23bd27205c7126cd9351ea3223239 | 2bdfd191049250b93d7a48e8cabfdd6853072cb4 | HackerspaceBlumenau/capybara | /slack/send_message.go | Go | go | 618 | no_license | package slack
import (
"errors"
"log"
"github.com/nlopes/slack"
)
var (
rtm *slack.RTM
ErrEmptyMessage = errors.New("empty message")
ErrEmptyChannel = errors.New("empty channel")
)
func SendMessage(msg, channel string) error {
if msg == "" {
return ErrEmptyMessage
}
if channel == "" {
return ErrEmpty... |
eb553e129cb1b6dff3d9c2162073d88c8246aa41 | b622d88a3a5f6d543d4888361dfa6a215505d5f4 | kiyor/gfind | /gfind.go | Go | go | 3,352 | no_license | /* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
* File Name : gfind.go
* Purpose :
* Creation Date : 03-24-2014
* Last Modified : Wed 21 May 2014 11:28:06 PM UTC
* Created By : Kiyor
_._._._._._._._._._._._._._._._._._._._._.*/
package main
import (
"flag"
"fmt"
"github.com/kiyor/gfind/lib"
"os"
"os/exec"
"st... |
9f3929c6e633dbd67c7466f3b3e214c0eb935146 | 21e8223d0fc3254789cb51b55143c774a1b889df | matt-farmer/n3-deep6 | /deep6.go | Go | go | 2,788 | permissive | //
// Deep6 is a simple embeddable hexastore graph database.
// To the core hexastore tuple index we add auto-generated
// links based on selected property values, and offer
// object traversals over linked data types.
//
// The use-case deep6 was creted for is to link data formats
// of different types in the educatio... |
6a2133baa234e2a5177034e1fb1a7967a11b19f4 | ebb1e574df5be41a429b595e28287d6c23fa34ac | david-ch/otus-homework-istio | /back-service/app/health/health.go | Go | go | 235 | no_license | package health
import (
"github.com/david-ch/otus-architect/back-service/util"
"net/http"
)
type health struct {
Status string
}
func onHealth(w http.ResponseWriter, r *http.Request) {
util.Resp(w, http.StatusOK, health{"OK"})
} |
b8395a2ebfde6865aec39a101bbbcfb05ac40c8c | 96f8b33d335133cb4dafe5bf2d752f378f241d85 | haoyong2010/perpare | /cron_usage/demo1/main.go | Go | go | 757 | no_license | package main
import (
"fmt"
"github.com/gorhill/cronexpr"
"time"
)
func main() {
var (
expr *cronexpr.Expression
err error
now time.Time
nextTime time.Time
)
//哪一分钟(0-59),哪一小时(0-23),哪天(1-31),哪月(1-12),星期几(0-6)
//每5分钟执行1次
if expr, err = cronexpr.Parse("*/5 * * * * * *"); err != nil {
fmt... |
fa3e557f9fe761a9a2d36ae1b40173f7662d641b | a7d7ed02c3aea72f7f36145dead9662d33adb4bf | eminetto/talk-microservices-go | /votes/main.go | Go | go | 1,515 | no_license | package main
import (
"encoding/json"
"github.com/codegangsta/negroni"
"github.com/eminetto/talk-microservices-go/pkg/middleware"
"github.com/google/uuid"
"github.com/gorilla/context"
"github.com/gorilla/mux"
"log"
"net/http"
"os"
"time"
"votes/vote"
)
func main() {
vService := vote.NewService()
r := mux... |
d31a917d6047fcb9d4c53915ba0ac432b4c77989 | 862498f600063dd1f8ec325f7532033b5ccc04cb | Volland/sidetree-core-go | /pkg/versions/0_1/txnprovider/models/coreindex_test.go | Go | go | 3,844 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package models
import (
"encoding/json"
"fmt"
"testing"
"github.com/stretchr/testify/require"
"github.com/trustbloc/sidetree-core-go/pkg/api/operation"
"github.com/trustbloc/sidetree-core-go/pkg/canonicalizer... |
539ae1636baa1b0925b35cc076c95974ac0c8e77 | 05607cc3f9a3c87772f7454b8ead43dc9b9dfd85 | vivienschilis/eddy | /event.go | Go | go | 530 | no_license | package main
import (
"encoding/json"
)
type Event struct {
At int64 `json:"at"`
TTL int `json:"ttl"`
Size int `json:"size"`
Data string `json:"data"`
}
func NewEvent(at int64, ttl int, size int, data string) *Event {
return &Event{at, ttl, size, data}
}
func LoadEvent(data []byte) (e *Event, err er... |
9432d02fc47f0936bdcf6e8d9bcb7099fa0e70b2 | fb5d6276a108ee707bf411b0c8838ef5736543e4 | instana/go-sensor | /instrumentation/instagraphql/example/database.go | Go | go | 890 | permissive | // (c) Copyright IBM Corp. 2023
package main
import (
"encoding/json"
"io/ioutil"
)
type data struct {
Chars []character `json:"characters"`
Ships []ship `json:"ships"`
}
func (d data) findChar(id int) *character {
for _, cr := range d.Chars {
if cr.Id == id {
return &cr
}
}
return nil
}
func (... |
e7c117bbf400db51ffe57cf0d7e82218c760116c | a35ba80d96d4c58e8e674e42b1c301e0424894ad | rabbitwlele/practicecode | /leetcode/226/main.go | Go | go | 327 | no_license | package main
import "fmt"
func main() {
fmt.Println("vim-go")
}
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
func invertTree(root *TreeNode) *TreeNode {
if root == nil {
return root
}
invertTree(root.Left)
invertTree(root.Right)
root.Left, root.Right = root.Right, root.Left
return ... |
b7657710040b960349a548827a6b583caff3318d | 596c7a02fcf484dda0b390e2d7ce02cb3d28fd8e | JadeHendry/GoClass | /NinjaExercise10/Exercise4_SelectStatement/exercise4.go | Go | go | 507 | no_license | package main
import (
"fmt"
)
func main() {
q := make(chan int)
c := gen(q)
receive(c, q)
fmt.Println("about to exit")
}
func gen(q chan<- int) <-chan int {
c := make(chan int)
go func() {
for i := 0; i < 100; i++ {
c <- i
}
q <- 1
close(c)
}()
return c
}
func receive(c, q <-chan int) {
for... |
84b784316a80d81f31b8a7a33b54f5719f57fc67 | 8f14ffcf1b0247e1d099f1f4ceaabb8b61a7bbc3 | DataDog/go-elasticsearch | /typedapi/types/enums/indicesblockoptions/indicesblockoptions.go | Go | go | 1,937 | permissive | // Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
d4e6e4fdd2d255536dc8087e411fae27800fbc1f | 72b2abcd47ea586d5e311bddde53ba62067c8fab | sjfbjs/kubedashadmin | /routers/router.go | Go | go | 2,526 | permissive | package routers
import (
"gin-vue/middleware/cors"
"gin-vue/middleware/myjwt"
"gin-vue/pkg/e"
"gin-vue/pkg/setting"
v1 "gin-vue/routers/api/v1"
v2 "gin-vue/routers/api/v2"
"github.com/gin-gonic/gin"
)
func InitRouter() *gin.Engine {
r := gin.New()
r.Use(gin.Logger())
r.Use(cors.CorsHandler())
r.Use(gin.Rec... |
f37d5f46d9cad850f25893781112a00337ab2a21 | 3b921af06fc219d2c70a70fb74e5ce8d3b4a5e04 | shanbay/ent | /entc/integration/customid/ent/schema/revision.go | Go | go | 542 | permissive | // Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
package schema
// User holds the schema definition for the User entity.
import (
"entgo.io/ent"
"entgo.io/ent/schema/field... |
10f0c6e1ff4e7d7938b3b999ee82fbee5ba236c6 | 9265d4e5a5256336d932edbbd3373e6606e13554 | imjorge/biscuit-ssh-ca | /pkg/ca/client.go | Go | go | 2,583 | permissive | package ca
import (
"context"
"crypto"
"crypto/ecdsa"
"crypto/ed25519"
"crypto/elliptic"
"crypto/rand"
"crypto/rsa"
"fmt"
"github.com/flynn/hallowgcp/pkg/pb"
"golang.org/x/crypto/ssh"
"google.golang.org/grpc"
)
type KeyType uint8
const (
KeyTypeECDSAP256 KeyType = iota
KeyTypeECDSAP384
KeyTypeECDSAP52... |
d432eb9672a0b594f4ba3547a4e9420edcf0ae06 | 4adbe3732885aab33a97faf37f42ed3cc0bd6ae0 | kim-hangyeol/Public_OpenMCP | /openmcp-snapshot/pkg/controller/snapshotrestore/controller.go | Go | go | 9,750 | permissive | package snapshotrestore
import (
"context"
"encoding/json"
"strconv"
"time"
nanumv1alpha1 "openmcp/openmcp/apis/snapshot/v1alpha1"
"openmcp/openmcp/omcplog"
"openmcp/openmcp/openmcp-snapshot/pkg/util"
config "openmcp/openmcp/openmcp-snapshot/pkg/util"
"openmcp/openmcp/openmcp-snapshot/pkg/util/etcd"
"openmc... |
bec9873baa114bd84d29b64d5c684ffe9c6e2b2b | 33f3e0cf34639a097f0935d6a64731965e12bb6f | HouLPcode/leetcode | /120.triangle.go | Go | go | 1,315 | no_license | /*
* @lc app=leetcode id=120 lang=golang
*
* [120] Triangle
*/
// 技巧:该题状态方程定义的时候是从低往顶找的
// 如果从上往下找,需要计算最后一行中的最小值,从下往上算,直接返回顶部节点值即可
// 其实,不用考虑成DP问题,人脑计算的时候也是从下往上的过程中选择小的数计算到顶部
func minimumTotal(triangle [][]int) int {
//状态方程: f(i,j) 从最底到(i,j)点的最小路径和
//状态转移方程: f(i,j) = triangle[i][j] + min( f(i+1,j), f(i+1,j+1) )
... |
43b970ec3eed41ad9f764b39cef607f981c09a38 | e748ada8622810c2e47de6a1a39b1cc59d192024 | shaozhenyu/sorter | /src/algorithms/heapsort/heapsort.go | Go | go | 543 | no_license | package heapsort
func createHeap(values []int, i, n int) {
k := 2*i + 1
for k < n {
if k < n-1 && values[k] < values[k+1] {
k++
}
if values[k] > values[i] {
values[k], values[i] = values[i], values[k]
i = k
k = 2*i + 1
} else {
break
}
}
}
func heapSort(values []int, n int) {
for i := n... |
0d3eab93220cb6e0fd11fb240c0133d65a6181a4 | ce6c90fcca49b79f026ada698fb0914d93a28a57 | notomo/qaper | /internal/client/datastore/httpc/httpc.go | Go | go | 1,148 | no_license | package httpc
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
// Client represents http client
type Client struct {
Port string
Domain string
}
// Post requests
func (c *Client) Post(path string, v interface{}) (*http.Response, []byte, error) {
content, err := json.Marshal(v)
if err != nil... |
20a7c850162dc9c7fd84eb97a6a77b5e0d5f0b0b | f4e91fb7804e1d6c6513bd891593f3ee2e95777b | QRXqrx/moonshine | /main.go | Go | go | 5,930 | permissive | package main
import (
"github.com/google/syzkaller/pkg/log"
. "github.com/shankarapailoor/moonshine/scanner"
. "github.com/shankarapailoor/moonshine/parser"
"github.com/google/syzkaller/prog"
"github.com/google/syzkaller/pkg/hash"
"fmt"
"os"
"github.com/google/syzkaller/pkg/db"
"io/ioutil"
"path/filepath"
"... |
9dfd3c5962a038c5ef5139f7a8cc3c8a5c8aaec2 | 5c0c4ff4eb1e10484e8941fcaa0ec8eabe7eae0d | jonathan-consensysHealth/firefly | /internal/database/sqlcommon/message_sql_test.go | Go | go | 17,701 | permissive | // Copyright © 2021 Kaleido, 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... |
018fcd2c11aaccf8c21aa95e75d5d787268725c9 | 6557fe4263b148e8a5a195af8ece2099d4fdb70b | drewkett/incrbtrfs | /subvolume.go | Go | go | 3,320 | no_license | package main
import (
"bufio"
"github.com/golang/snappy"
"log"
"os"
"os/exec"
"path"
"strings"
)
type Subvolume struct {
Directory string
SnapshotsLoc SnapshotsLoc
Remotes []RemoteSnapshotsLoc
}
func (subvolume Subvolume) Print() {
if verbosity > 0 {
log.Printf("Subvolume='%s'", subvolume.Direct... |
2605377fdf29d9646996412365c142bd891575d8 | 4a2eace73bef1865d1c821287adff036eaf752b6 | mosaaballou/feedpushr | /main.go | Go | go | 2,699 | permissive | package main
import (
"context"
"flag"
"os"
"os/signal"
"syscall"
"time"
"github.com/ncarlier/feedpushr/pkg/config"
"github.com/ncarlier/feedpushr/pkg/job"
"github.com/ncarlier/feedpushr/pkg/logging"
"github.com/ncarlier/feedpushr/pkg/metric"
"github.com/ncarlier/feedpushr/pkg/service"
"github.com/ncarlie... |
fdb12d7bc4aefd226d34b4baa4d1a54cd38dd468 | cbed79fb7a2d7d025dc3c0ee0966e087dd1aafeb | wangyi1310/yaml | /test-go/oop/rest.go | Go | go | 305 | no_license | package main
import "fmt"
type test struct {
Id string
Name string
}
func (t *test) construct() {
fmt.Println("constructting")
}
func (t *test) destruct() {
fmt.Println("destructting")
}
func main() {
var t test
t.construct()
t.destruct()
t1 := new(test)
t1.construct()
t1.destruct()
}
|
729ad29f19be01d4920228c984834aa7e8e03fd9 | aecc95054caf083492b294efdd28bda923d3a937 | junwen-k/estemplate | /tokenizer_ngram_test.go | Go | go | 1,301 | permissive | // Copyright (c) KwanJunWen
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
package estemplate
import (
"encoding/json"
"testing"
)
func TestTokenizerNGramSerialization(t *testing.T) {
tests := []struct {
desc string
n ... |
aba3ebdb047513b7b0241bf445c9bb786f82a0bf | f9ec0257d0d59ddc61cc57064768249775a5fcda | gnanaikya/erda | /modules/hepa/repository/service/gateway_package_service.go | Go | go | 5,631 | permissive | // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
cfbb21d300a6655e21135a5bb70d5f7a7c6b500c | 9f8fd86ee6e216a6a316cf56a34a92553f62e93e | schultet/goa | /pkg/pddl/types_test.go | Go | go | 707 | permissive | package pddl
import (
"fmt"
"strings"
"testing"
"github.com/schultet/goa/pkg/util/slice"
)
func init() {
fmt.Println("testing types...")
}
// _____________________________________________________________________________
func TestParseTypes(t *testing.T) {
typetokens := strings.Fields(`( :types location agent ... |
71d4c9b6d0ad386202f752aa342b1eba27b8fe3b | 50d7e18ac932d49d109be5bc8acdba90789e2df4 | Nepomuceno/msgraph | /src/model_collection_of_identity_provider.go | Go | go | 1,740 | no_license | /*
* OData Service for namespace microsoft.graph
*
* This OData service is located at https://graph.microsoft.com/v1.0/
*
* API version: 1.0.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package msgraph
import (
"encoding/json"
)
// CollectionOfIdentityProvider struct for CollectionOf... |
838dd70bc7b49914b22ffdb64ed8b7ba8161e22c | ca6cc93a8495bc019c8c2717035e31166f4c0e8a | chic01taliano/golang | /main.go | Go | go | 328 | no_license | package main
import (
"./greeting"
)
func main() {
salutations := greeting.Salutations{
{"Bob", "Hello"},
{"Joe", "Hi"},
{"Mary", "What is up?"},
}
salutations[0].Rename("Alex")
salutations.Greet(greeting.CreatePrintFunction("!!!"), true, 6)
//salutations.Greet(greeting.CreatePrintFunction("!!!"), tru... |
13794632db3c6c1204bb036a9fcab0f72f8faac2 | ea88c7d3ab695ced4ca1b8fccea86f08a6db1876 | leepengxiang/opencensus-service | /internal/collector/processor/processor_to_sink.go | Go | go | 1,325 | permissive | // Copyright 2018, OpenCensus 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 agree... |
bbbe384b1492406ed175f97893420b8ffce5b886 | 956987799c9c28a1d64474d6c53970ded7027181 | Xiot/zanzibar | /codegen/module_system.go | Go | go | 45,598 | permissive | // Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
09637da6a874ab59c5835e5b75fe2ac2318be21f | 404dde247885b90a58f37096af8a4742262353ba | LivesOne/Backend | /src/servlets/common/db_wrapper_withdraw_fee.go | Go | go | 929 | no_license | package common
const (
REDIS_WITHDRAW_QUOTA_KEY = "withdraw:quota:"
)
type (
WithdrawFee struct {
Id int64 `json:"id,omitempty"`
Currency string `json:"currency,omitempty"`
FeeCurrency string `json:"fee_currency"`
FeeType int `json:"fee_type"`
FeeFixed float64 `json:"fee_fixed"`... |
971961f858734e74cde0a9afd5d5884cbfeea6f5 | 26428e2961c4478d698a1d1772ce4a8aa2949970 | azhar-azad/golang-learning | /src/github.com/azhar-azad/projects/traversy_media_rest_api/main.go | Go | go | 2,461 | no_license | package main
import (
"encoding/json"
"log"
"math/rand"
"net/http"
"strconv"
"github.com/gorilla/mux"
)
// Book Struct (Model)
type Book struct {
ID string `json:"id"`
Isbn string `json:"isbn"`
Title string `json:"title"`
Author *Author `json:"author"`
}
// Author Struct
type Author struct {
Fi... |
de04aeb88db51d321c2dc54df91b20a401e2f512 | 2e63ca965930843cdf26c5bd0f426d4521e477b3 | Aaryan-kapur/hactktoberfesttimebois2021 | /go/Go-Microservice/account/endpoint.go | Go | go | 850 | no_license | package account
import (
"context"
"github.com/go-kit/kit/endpoint"
)
type Endpoints struct {
CreateUser endpoint.Endpoint
GetUser endpoint.Endpoint
}
func MakeEndpoints(s Service) Endpoints {
return Endpoints{
CreateUser: makeCreateUserEndpoint(s),
GetUser: makeGetUserEndpoint(s),
}
}
func makeCre... |
e58b8ecc959cb28eaed11ce155075746dac12730 | 746e3a2600035ba86f8be09052b2a795d5a62e5b | funkygao/fae | /client/go/stress/main.go | Go | go | 2,342 | no_license | // stress test of fae
// simulate 3000 concurrent php-fpm requests for several rounds
package main
import (
"flag"
"github.com/funkygao/etclib"
"github.com/funkygao/fae/config"
"github.com/funkygao/fae/servant/proxy"
"github.com/funkygao/golib/gofmt"
"github.com/funkygao/golib/server"
"log"
"os"
"sync"
"time... |
4110c156c03dca7bd169eede59cdc6592bc225cd | bc779935a3358a9d8c18dbad932794ee033b5c0e | ebfe/scaleway-cli | /pkg/cli/cmd_tag.go | Go | go | 857 | permissive | // Copyright (C) 2015 Scaleway. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE.md file.
package cli
import "github.com/scaleway/scaleway-cli/pkg/commands"
var cmdTag = &Command{
Exec: runTag,
UsageLine: "tag [OPTIONS] SNAPSHOT NAME",
... |
cbab6a000587bc572b78a7bbaf8d42a8523e06ab | ad882edc6dda4dbb368009d28d09c95cd97a9e62 | yudapc/sorabel | /helpers/query-string.go | Go | go | 563 | no_license | package helpers
import (
"strconv"
"github.com/labstack/echo"
)
func QueryString(context echo.Context) (int, int, int, string) {
page, _ := strconv.Atoi(context.QueryParam("page"))
if page < 1 {
page = 1
}
limit, _ := strconv.Atoi(context.QueryParam("limit"))
if limit < 1 {
limit = 5
}
orderBy := contex... |
aa365c11f97635b2558cc6a7032dfe66689f18f6 | 7dda9fb1db99497dda600c60823c940bcd9a5398 | smm-goddess/leetcode | /008-atio/atoi.go | Go | go | 1,095 | permissive | package main
import (
"fmt"
"math"
)
func main() {
//fmt.Println(myAtio(" "))
//fmt.Println(myAtio("13213123123213"))
//fmt.Println(myAtio("-42"))
//fmt.Println(myAtio("42"))
//fmt.Println(myAtio("words and 987"))
//fmt.Println(myAtio(" 42"))
//fmt.Println(myAtio("4193 with words"))
//fmt.Println(myAtio(... |
6ff8354cd928137c035b3b84333cfa0149eb69df | c64a367065b789554c46230df64c458fe88be7e7 | hiroponz/gitpanda | /gitlab/project_fetcher.go | Go | go | 1,173 | permissive | package gitlab
import (
"fmt"
"github.com/xanzy/go-gitlab"
"regexp"
"strings"
"time"
)
type projectFetcher struct {
}
func (f *projectFetcher) fetchPath(path string, client *gitlab.Client, isDebugLogging bool) (*Page, error) {
re := regexp.MustCompile("^([^/]+)/([^/]+)/?$")
matched := re.FindStringSubmatch(pa... |
62c6878f472337d667d8edd1eb809e017db63498 | 4ca20fb8cceb6d0d6658dd9be89150739f99aae5 | MarksGui/algorithms | /tree/merge-two-binary-trees_617/run_test.go | Go | go | 781 | no_license | package merge_two_binary_trees_617
import (
"algorithms/tree"
"reflect"
"testing"
)
func TestMergeTreesRecursive(t *testing.T) {
type args struct {
t1 *tree.TreeNode
t2 *tree.TreeNode
}
tests := []struct {
name string
args args
want *tree.TreeNode
}{
{
name: "递归",
args: args{
t1: tree.Cre... |
dc256d3f050b931102f3546239a23326ec992fc0 | 1863e12d592988f46fce690b6f41c1fbdc4a780e | dennischancs/rttys | /device.go | Go | go | 4,905 | permissive | package main
import (
"bufio"
"crypto/rand"
"crypto/tls"
"github.com/rs/zerolog/log"
"io"
"net"
"strings"
"sync"
"time"
)
const (
MsgTypeRegister = 0x00
MsgTypeLogin = 0x01
MsgTypeLogout = 0x02
MsgTypeTermData = 0x03
MsgTypeWinsize = 0x04
MsgTypeCmd = 0x05
MsgTypeHeartbeat = 0x06
Msg... |
a66adf3f5c7bd5fadfed95a2a07e502e968fe619 | 6f07b71ee159e172fd47c796ee7a77d3d2a96521 | philipjkim/goji101 | /main.go | Go | go | 3,638 | no_license | package main
import (
"flag"
"fmt"
"io"
"net/http"
"regexp"
"strconv"
"time"
"github.com/goji/param"
"github.com/zenazn/goji"
"github.com/zenazn/goji/web"
"github.com/zenazn/goji/web/middleware"
)
func main() {
flag.Set("bind", ":8000")
goji.Get("/", Root)
goji.Get("/greets", http.RedirectHandler("/",... |
fa8a7cbb16a2f039eba286e12898e9ae4b12ff80 | b8285db64f0d741b545fa0c11365a28789a6f3f7 | jiawei397/goTest | /src/hello.go | Go | go | 213 | no_license | package main
import (
conf "hello/conf/loadConf.go"
)
var a = "G"
func main() {
n()
m()
n()
print(conf.HTTPPort)
}
func n() { print(a) }
func m() {
// a := "O" //这是私有变量
a = "O"
print(a)
}
|
2c9f3f60864be8a6a54e21874c1028a42eaeb078 | f54367e5c7d0072dec2e5eebbb6b96d3aa347c05 | TsuyoshiUshio/azure-service-broker | /pkg/services/mysql/catalog.go | Go | go | 2,752 | permissive | package mysql
import "github.com/Azure/azure-service-broker/pkg/service"
func (m *module) GetCatalog() (service.Catalog, error) {
return service.NewCatalog([]service.Service{
service.NewService(
&service.ServiceProperties{
ID: "997b8372-8dac-40ac-ae65-758b4a5075a5",
Name: "azure-mysqldb"... |
25d246039cc04b7f5cfbb2208c17c42892872d54 | 74ba9d68fc9742e6f45c9a46a5cec0c41737d686 | nickjones/proc_box | /Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/bugsnag/bugsnag.go | Go | go | 2,042 | permissive | package logrus_bugsnag
import (
"errors"
"github.com/bugsnag/bugsnag-go"
"github.com/nickjones/proc_box/Godeps/_workspace/src/github.com/Sirupsen/logrus"
)
type bugsnagHook struct{}
// ErrBugsnagUnconfigured is returned if NewBugsnagHook is called before
// bugsnag.Configure. Bugsnag must be configured before th... |
7da33a9977fb83ed2c72b85b3676a084fb5dcb40 | c1adbceb8c17e56175384a3904b03208c9db4b17 | innerpeacez/skywalking-cli | /internal/commands/browser/logs/list.go | Go | go | 2,654 | permissive | // Licensed to 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. Apache Software Foundation (ASF) licenses this file to you under
// the Apache License, Version 2.0 (the "Li... |
91113f2905b91cf504a479032b965fd047f0f133 | c50600c62b407d001ee19e5acf68c6c8051e3e32 | yousong/onecloud | /pkg/cloudprovider/images.go | Go | go | 2,270 | permissive | // Copyright 2019 Yunion
//
// 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 writi... |
ccc94db1b58573b5c288ecdab85013825ac875d1 | 1de250893bddb8745f9ad8a3df1979d1ff4b6ae1 | nrc/tinykv | /kv/tikv/mvcc.go | Go | go | 35,762 | no_license | package tikv
// import (
// "bufio"
// "bytes"
// "context"
// "encoding/binary"
// "math"
// "os"
// "sync"
// "sync/atomic"
// "time"
// "unsafe"
// "github.com/coocood/badger"
// "github.com/juju/errors"
// "github.com/ngaut/log"
// "github.com/pingcap-incubator/tinykv/kv/lockstore"
// "github.com/p... |
134db94590986f592837bffb9aa5308a91239a17 | ea582226552fc68afa10934eaea4f94c9230e4eb | mleonidas/relay | /pkg/format/error.go | Go | go | 2,303 | permissive | package format
import (
"encoding/json"
"fmt"
"strings"
"github.com/puppetlabs/errawr-go/v2/pkg/encoding"
"github.com/puppetlabs/relay/pkg/config"
"github.com/puppetlabs/relay/pkg/errors"
"github.com/spf13/cobra"
)
func Error(err error, cmd *cobra.Command) string {
// attempt to load config for display optio... |
ddaf78659fc55366e363f25cf735d2d153a8fb8f | 07086ce81081a4a730ae352fb820250a122c4aeb | vikashvverma/eventers | /pkg/api/user/logging/user.go | Go | go | 2,244 | permissive | package user
import (
"time"
"github.com/labstack/echo"
"github.com/vikashvverma/eventers/pkg/api/user"
"github.com/vikashvverma/eventers/pkg/utl/model"
)
// New creates new user logging service
func New(svc user.Service, logger eventers.Logger) *LogService {
return &LogService{
Service: svc,
logger: logge... |
725500400f6bfaf7300d3169d687b23da751b706 | 0a458bff64c0523deeedb13303039ccd2ba1194a | Mattlk13/oci-go-sdk | /networkloadbalancer/network_load_balancing_policy.go | Go | go | 1,535 | permissive | // Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
4c2ac8ba9fbabc5ccddb7cb934196c0acb368f82 | 0bf5d1888a8f84d46586c992e88c4401c9d9caa2 | tstromberg/hub | /cmd/hub/cmd/build.go | Go | go | 3,625 | permissive | package cmd
import (
"os"
"path"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/tinkerbell/actions/pkg/artifacthub"
"github.com/tinkerbell/actions/pkg/git"
"github.com/tinkerbell/actions/pkg/img"
)
type buildOptions struct {
context string
containerRepo string
dryRun bool
push ... |
79c2dce3fd0d67e1fd009c377ccb5d478ef050e3 | 8fab3b880bcb460463090c37dc3e6a3650c6381a | polyverse-security/vulcand | /Godeps/_workspace/src/github.com/mailgun/scroll/app.go | Go | go | 6,340 | permissive | package scroll
import (
"fmt"
"net/http"
"os"
"os/signal"
"syscall"
"time"
"github.com/polyverse-security/vulcand/Godeps/_workspace/src/github.com/gorilla/mux"
"github.com/polyverse-security/vulcand/Godeps/_workspace/src/github.com/mailgun/log"
"github.com/polyverse-security/vulcand/Godeps/_workspace/src/git... |
0957e45c04e4a4333672ad21261889df1d0e08db | de5af0b378beaff043287ba598d48a7f28d4ab2b | jhlee9623/friday | /server/start.go | Go | go | 6,180 | permissive | package server
// DONTCOVER
import (
"fmt"
"os"
"runtime/pprof"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/hdac-io/tendermint/abci/server"
tcmd "github.com/hdac-io/tendermint/cmd/tendermint/commands"
cmn "github.com/hdac-io/tendermint/libs/common"
"github.com/hdac-io/tendermint/node"
"gi... |
0d36b5c094256a814fb8060dcb3c64130d2e1100 | 3da311adb3ea95642f8fd732ec941df8c85c30b8 | almadireddy/nyt-explore-articles | /store.go | Go | go | 2,322 | no_license | package main
import (
"cloud.google.com/go/firestore"
"context"
"google.golang.org/api/iterator"
)
type Store interface {
GetArticles(ctx context.Context) ([]*Article, error)
GetArticlesByLocation(ctx context.Context, location string) ([]*Article, error)
GetImages(ctx context.Context) ([]*Image, error)
SaveArt... |
0e04ebee29f02fa3f4c1596f8a009d3cb4910e15 | 8c450337e545b68a1b97d94e21fb73e40198cec5 | losinggeneration/pipeln | /html/template/doc.go | Go | go | 634 | permissive | /*
This provides some helpers for using within templates. It allows you to
quite easily include scripts & stylesheets within a template.
Example
import "html/template"
import helpers "pipeln/html/template"
...
t, err := template.New("foo").Parse(`<html><head>
{{stylesheet_link_tag "foo.css"}}
{{javascript_include_tag... |
57dc4ee85ccd9af5e2f3bd6eb5417ae909ee0529 | fe40f7c7c2142cdc7746f7b52c22b6e8980dbcf2 | Aaaaaaron/CMU440 | /class 05/chanbuf/abuf/abuf_race_test.go | Go | go | 2,541 | no_license | // Testing code for concurrent buffer.
// This test generates long sequence of insertions, removals, and flushes
// in attempt to hit race condition
package abuf
import (
"fmt"
"runtime"
"testing"
"time"
)
// How many repetitions
var nrun int = 5
// Used to detect when all removers are done
var rdone []bool
//... |
8f182bf5b62d78748ce9a4d11250cc5bf6787e34 | 24b64609a3747b4f4a08e5900ca310e1f3d24f02 | awesome-nfv/yanff | /test/stability/test_separate/test-separate-part2.go | Go | go | 1,145 | permissive | // Copyright 2017 Intel Corporation.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"github.com/intel-go/yanff/flow"
"github.com/intel-go/yanff/packet"
"github.com/intel-go/yanff/rules"
)
var L3Rules *rules.L3Rules
// Main function fo... |
9037b2ec02ec6dfdaee620d52a5c2111d4fa7e1f | dae7801c26376f329401287636e69935249e4768 | aesadde/logrus-stackdriver-formatter | /middleware.go | Go | go | 2,796 | permissive | package stackdriver
import (
"fmt"
"math"
"net/http"
"strconv"
"time"
"github.com/felixge/httpsnoop"
"github.com/gin-gonic/gin"
"github.com/hellofresh/logging-go/context"
"github.com/sirupsen/logrus"
)
// LoggingMiddleware is a middleware for writing request logs in a stuctured
// format to stackdriver.
fun... |
ed48f552067b447c527361a9f0310dc4db60dfb7 | f6a0c2e4026ec92a8d76ed7f01263d389379eb36 | jayunit100/ose-scanner | /controller/vendor/github.com/openshift/origin/pkg/user/api/deep_copy_generated.go | Go | go | 4,635 | permissive | // +build !ignore_autogenerated_openshift
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package api
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func init() {
if err := api.Scheme.AddGenera... |
e5ef2d48bdb55c28888f2b4e87c773680bfef23c | 358656f8d9cba57c5dd1605a362f00a94a19fe44 | roverdotcom/tectonic-installer | /installer/pkg/terraform-generator/generator.go | Go | go | 1,205 | permissive | package terraformgenerator
import (
"encoding/json"
"github.com/coreos/tectonic-installer/installer/pkg/config"
)
// TerraformGenerator defines the terraform config generator for a cluster.
type TerraformGenerator struct {
config.Cluster
}
type tfVars struct {
AWS `json:",inline"`
Azure `json:",inlin... |
52641a1611a514956956757ed726c7d9ba55a739 | f1814a0d88437b61c22c9c491521ca41ccac0502 | ZhongguancunScienceCityBrainCompany/xuperchain | /core/p2p/p2pv2/stream_limit.go | Go | go | 3,097 | permissive | package p2pv2
import (
"os"
"strings"
"sync"
peer "github.com/libp2p/go-libp2p-peer"
"github.com/xuperchain/log15"
)
// StreamLimit limit the peerID amount of same ip
type StreamLimit struct {
// Store all streams available
// key: addr value: peerID
streams *sync.Map
// key:ip value: amount of same ip
... |
e0cdce9d53addceea39fa382d6bc579805a73136 | 1238c12cd375adfa9b021f8ee4ccb026345ecf58 | sgtest/monorepo-test-3 | /kubernetes-13/pkg/volume/azure_file/doc.go | Go | go | 768 | permissive | /*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
debb8b5455380b1263b9507f2b90c70a49a77362 | 445470a6130cbfb75888b31163fde5b930402120 | sj-porter-dev/m3 | /src/dbnode/client/session.go | Go | go | 125,763 | permissive | // Copyright (c) 2016 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
2537aabe5c942c5402231333e275cfd4e3975b13 | f5f89ff494381885e11f4304ccbf091e84d18d2b | mazrean/parallel_processing | /context/1/main.go | Go | go | 309 | no_license | package main
import (
"fmt"
"time"
)
func despair() {
for {
fmt.Println("Help me!")
}
}
func main() {
go despair()
time.Sleep(time.Second * 1)
/*この時点でエラーが発生。
しかしdespairは知らされず苦しみ続ける…*/
fmt.Println("error!")
time.Sleep(time.Second * 1)
}
|
520eeab0eb14e9a95048d3bc621906bddf7f34be | 79e66354333f373f7b09baa218c4d94af9282a41 | cyril-ui-developer/console | /cmd/bridge/main.go | Go | go | 35,330 | permissive | package main
import (
"context"
"crypto/tls"
"crypto/x509"
"encoding/json"
"flag"
"fmt"
"runtime"
"io/ioutil"
"net/http"
"net/url"
"os"
"strings"
"github.com/openshift/console/pkg/auth"
"github.com/openshift/console/pkg/bridge"
"github.com/openshift/console/pkg/knative"
"github.com/openshift/console/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.