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 |
|---|---|---|---|---|---|---|---|---|
d91689ef75cc1904deb264bc16efb43c16d1d908 | e547acb5efa83d57cff5f782b570fc03cec34e07 | kebabmane/notely-api | /controller/health.go | Go | go | 300 | no_license | package controller
import (
"net/http"
)
// HealthFunction fetches from model and returns json
func HealthFunction(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write([]byte("{\"message\": \"Health is A OK!!\"}"))
}
|
28427ab74cc5e76d9edb2e300c8c448411dbd226 | 6fcc72a5aefdd3310c59cdcb6909a28da9f42ae5 | 7aske/gitstats-go | /src/utils/utils.go | Go | go | 481 | no_license | package utils
import (
"bufio"
"os"
"strings"
)
func Contains(q string, l []string) bool {
for _, s := range l {
if s == q {
return true
}
}
return false
}
func HasUser(q string, fi *os.File) bool {
reader := bufio.NewReader(fi)
for {
if line, err := reader.ReadString('\n'); err == nil {
if strin... |
1991206a6da150d27e4fe55211679144222fa81e | 4a89ff67701fd016393b366369f73398cee5bebc | weaviate/weaviate | /modules/sum-transformers/module.go | Go | go | 2,704 | permissive | // _ _
// __ _____ __ ___ ___ __ _| |_ ___
// \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
// \ V V / __/ (_| |\ V /| | (_| | || __/
// \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
//
// Copyright © 2016 - 2023 Weaviate B.V. All rights reserved.
//
// CONTACT: hello@weaviate.i... |
f6967d84c2bb9a57814569d81173d57d264809dc | 5f29ffa99b72d3396dacc98d4551bd9b6ccd4eef | Moopli/aries-framework-go | /pkg/crypto/tinkcrypto/primitive/bbs/subtle/bls12381g2_verifier.go | Go | go | 811 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package subtle
import (
"github.com/hyperledger/aries-framework-go/component/kmscrypto/crypto/tinkcrypto/primitive/bbs/subtle"
)
// BLS12381G2Verifier is the BBS+ signature/proof verifier for keys on BLS12-381 curv... |
018c2df2e0bcd54f0c924a124e98a09069c38273 | ce1a2128a15c37b8d12faa8c781ae53b55304e1f | JamesDunne/go-ryan | /ryanweb/main.go | Go | go | 11,327 | no_license | package main
import (
"flag"
"fmt"
"html/template"
"image"
"image/jpeg"
"io"
"log"
"mime"
"net"
"net/http"
"os"
"os/signal"
"path"
"path/filepath"
"sort"
"strings"
"syscall"
)
import (
"github.com/JamesDunne/go-ryan/resize"
)
// Web host info:
var proxyRoot, siteHost string
// Parsed HTML template... |
4682bc35a4c597eeb460b54ee5d63465bf13fddc | ea2342d6757e5d64a6ab72e72cc896c70b5698f1 | digitalocean/autoscaler | /vertical-pod-autoscaler/pkg/updater/main.go | Go | go | 4,845 | 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, ... |
f070ecd56633e91f75adc99926ab32e2ad06b251 | dcbc7c3a8444a542a703f8addf836bfb2eea343d | hz7680/dingtalkSdk | /client/callback.go | Go | go | 2,054 | no_license | package client
import (
"encoding/json"
"errors"
"github.com/hz7680/dingtalkSdk/model"
"github.com/hz7680/dingtalkSdk/utils"
)
func (c *Client) DeleteCallback() (resp *model.DeleteCallbackResp, err error) {
token, err := c.GetAccessToken()
if err != nil {
return
}
url := "https://oapi.dingtalk.com/call_back... |
95efb90570acd35d1a8abf78d68f0c4da40b3160 | 191a261f6f8c8e3da53b0d4c1a8f10f1539a9217 | ehashman/ARO-RP | /pkg/operator/controllers/monitoring/monitoring_controller_test.go | Go | go | 3,981 | permissive | package monitoring
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
import (
"context"
"strings"
"testing"
"github.com/sirupsen/logrus"
"github.com/ugorji/go/codec"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
ctrl ... |
742fdc4e66de57dd5ddab30c61de65c67aac9abf | f6dea20c3598a020263e6594854166a00f652076 | golwei/wx-gin | /handlefunc_main.go | Go | go | 1,076 | no_license | package main
import (
"fmt"
"net/http"
"github.com/jinzhu/gorm"
_ "github.com/mattn/go-sqlite3"
"github.com/qor/admin"
)
// Create a GORM-backend model
type User struct {
gorm.Model
Name string
}
// Create another GORM-backend model
type Product struct {
gorm.Model
Name string
Description string
}
... |
34a60d3135e21655a6067c19ac444428473c8e0a | eaf89513005f6e57131e23f7ac8304493a03ef11 | Noc2/polkadot-k8s-operator | /test/e2e/main_test.go | Go | go | 6,516 | permissive | package e2e
import (
goctx "context"
"github.com/operator-framework/operator-sdk/pkg/test/e2eutil"
"github.com/swisscom-blockchain/polkadot-k8s-operator/pkg/apis"
polkadotv1alpha1 "github.com/swisscom-blockchain/polkadot-k8s-operator/pkg/apis/polkadot/v1alpha1"
"github.com/swisscom-blockchain/polkadot-k8s-operato... |
46ee98c60aa9d732b3f3a4b4ca9d3fcfd59485ed | b913fe31ab4fdf83ffec55707542876330fe8399 | jim-minter/service-catalog | /pkg/apis/servicecatalog/v1alpha1/zz_generated.conversion.go | Go | go | 50,728 | 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... |
6bc9c1696178a5d8baf7b7f728ce0a7362bb5341 | 280edc176aef1a85ad9df381d6829cf7ac2f030b | antares-grus/gateway | /testsuite/miniogw/gateway_test.go | Go | go | 41,757 | permissive | // Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package miniogw_test
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"io/ioutil"
"sort"
"strings"
"testing"
"time"
"github.com/btcsuite/btcutil/base58"
minio "github.com/minio/minio/cmd"
"github.com/minio/minio/pkg/auth"
"git... |
dcb8edad545ae0391e5a1cb9a50bd00804e02559 | 5050076db1c83dccbac02bd9e3ac58ffe3879d74 | harness/harness-go-sdk | /harness/nextgen/model_service_now_adfs.go | Go | go | 701 | permissive | /*
* Harness NextGen Software Delivery Platform API Reference
*
* This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of the breaking change with respect to the generated code stub
*
* API version: 3.0
* Contact: contact@harness.io
* Generated by: Swagger Codegen (https:... |
17f39250fe70e368e675670ea49ee85f575bf6f8 | 402fda0a8dbb83ff1ae14a7f1175cd70b39bd707 | evilmarty/tapedeck | /temp_library_test.go | Go | go | 341 | permissive | package tapedeck
import (
"os"
"testing"
)
func Test_tempLibrary_Close(t *testing.T) {
library := newTempLibrary()
if err := library.Close(); err != nil {
t.Fatalf("Unexpected error: %s", err)
}
if _, err := os.Stat(library.Config.BasePath); os.IsExist(err) {
t.Errorf("Expected %s to be deleted", library.C... |
ef62445ecc6310dc4a9fb0cf8c0cb6295718970f | cf5ced15aac1f3abe65634ae614cc2c2e4833f6a | maxandersen/odo | /pkg/odo/commonflags/platform.go | Go | go | 2,324 | permissive | package commonflags
import (
"context"
"errors"
"flag"
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/redhat-developer/odo/pkg/odo/cli/feature"
"github.com/redhat-developer/odo/pkg/odo/cmdline"
)
const (
// PlatformFlagName is the name of the flag allowing user to specify target platfo... |
e1abf263e2bbfbb6f65d33d1d326045fe409340b | 1273600a959eba9855f4f74c05e84af2a96b77f2 | yjicfdx/vitess | /go/vt/vttablet/tabletserver/planbuilder/permission_test.go | Go | go | 3,890 | permissive | /*
Copyright 2018 The Vitess 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... |
94f71b9c301dd07200970b2335b3b97de870637a | 366c3281416be73cb214e371389e0b8995820c31 | wking/insights-operator | /pkg/gatherers/clusterconfig/certificate_signing_requests.go | Go | go | 9,239 | permissive | package clusterconfig
import (
"context"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"time"
certificatesv1api "k8s.io/api/certificates/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/json"
"k8s.io/client-go/kubernetes"
certific... |
8ac4503fa2f251030e9a88e1f74e14f368b8486c | 75bfbf117245accafdeb4ec66feee52765441077 | petejkim/matic-jagar | /targets/heimdall_missed_blocks.go | Go | go | 6,753 | permissive | package targets
import (
"fmt"
"log"
"strconv"
"strings"
client "github.com/influxdata/influxdb1-client/v2"
"github.com/vitwit/matic-jagar/alerter"
"github.com/vitwit/matic-jagar/config"
db "github.com/vitwit/matic-jagar/influxdb"
"github.com/vitwit/matic-jagar/scraper"
"github.com/vitwit/matic-jagar/types... |
3ecdb48abd5b430c140c5b804091911ac0158480 | 4783e8c4e8764f26bbb07045ab2f741f2a5b1f60 | zkbqhuang/Bagisaja-go | /model/goodsComment.go | Go | go | 1,416 | permissive | package model
import (
"github.com/astaxie/beego/logs"
"strings"
"time"
)
type GoodsComment struct {
Id int `gorm:"primary_key" json:"id"`
Score int `json:"score"`
UserId int `json:"user_id"`
GoodsId int `json:"goods_id"`
OrderId int `json:"order_id"`
Images string `json:"images"`
Co... |
b34a8ca5fcfe0b03ffa14d94c4f32af1a377cc26 | 42dac296c3891e9cec83883c9ef6c2d81777bb0c | elmiko/oshinko-rest | /vendor/github.com/openshift/origin/pkg/project/admission/nodeenv/admission_test.go | Go | go | 5,151 | permissive | package nodeenv
import (
"testing"
"k8s.io/kubernetes/pkg/admission"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/cache"
clientsetfake "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
projectcache "github.com/open... |
246125611a031675bac34f78dcb53abe0f7faddb | ad16d8657ac8d9a39aef3a6dd7ebfde4b208d013 | kevzim/rod | /element.go | Go | go | 12,722 | permissive | package rod
import (
"context"
"encoding/base64"
"fmt"
"io"
"path/filepath"
"strings"
"time"
"github.com/tidwall/gjson"
"github.com/go-rod/rod/lib/assets/js"
"github.com/go-rod/rod/lib/proto"
"github.com/go-rod/rod/lib/utils"
"github.com/ysmood/kit"
)
// Element represents the DOM element
type Element s... |
c0b0f2b666f29367e6082c91f792643b0c2baefc | e50f6a12e90d5db4b57f3b0e9155598a14c2d89d | go-spring/go-spring | /spring/spring-core/web/constants.go | Go | go | 4,470 | permissive | /*
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
25c0046c83f0c3092f5680e1c1452ea9f0dafbf4 | 02f1e917c7e3daae0b11b61dbd48480bef0dc288 | ssst0n3/lightweight_db | /common_test.go | Go | go | 3,771 | no_license | package lightweight_db
import (
"github.com/davecgh/go-spew/spew"
"github.com/sirupsen/logrus"
"github.com/ssst0n3/awesome_libs"
"github.com/ssst0n3/lightweight_db/test/test_data"
"github.com/stretchr/testify/assert"
_ "modernc.org/sqlite"
"testing"
)
const (
driverName = "sqlite"
)
var Conn Connector
func ... |
62c4668854b2078c5c27c5e21e9e973d5c8b811a | f870f7e6980ea72fceed16e06b10b80a80ea5d4a | sofyan48/bgin | /app/server/router.go | Go | go | 867 | permissive | package server
import (
"github.com/gin-gonic/gin"
)
// Routes Create Routes Models
func Routes() *gin.Engine {
router := gin.New()
router.Use(gin.Logger())
router.Use(gin.Recovery())
router.Use(CORSMiddleware())
return router
}
// CORSMiddleware Corss Allow Function
func CORSMiddleware() gin.HandlerFunc {
re... |
cc2e16156fadff863416ecfb5aac8665a8202bd1 | a073832c35a5b6c811786a36512f5e3cf3434e70 | GodKi1erAron/kubernetes | /pkg/registry/core/node/storage/storage.go | Go | go | 5,592 | permissive | /*
Copyright 2015 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, ... |
9ecb0c66422e29526af059868ba480a5975899ed | a2ada6a39ff5d65944cc0257d81003a238db723d | JWiryo/DiscordSimpleChatBot | /handler/DiscordHandler.go | Go | go | 2,324 | no_license | package handler
import (
speech "DiscordSimpleChatBot/speech"
"context"
"fmt"
"strconv"
"strings"
"github.com/bwmarrin/discordgo"
"github.com/goinvest/iexcloud/examples/iexcloud/domain"
iex "github.com/goinvest/iexcloud/v2"
"github.com/turnage/graw/reddit"
)
// MessageCreate - Detect Message Create Event
//... |
aa7f1765ba69b8dd4f73bbccde28abb39c0e6267 | a4c0ef5802d62a01b092f51912215d602c106d05 | msfukui/tdd-by-example-for-go | /franc.go | Go | go | 387 | no_license | package money
// Franc struct is the difinition of a US currency unit.
type Franc struct {
Money
}
// NewFranc is Franc's constructor
func NewFranc(amount int) *Franc {
c := new(Franc)
c.amount = amount
c.name = "Franc"
return c
}
// Times multiplies a Franc amount by the specified value.
func (d *Franc) Times(... |
165b593de84233406fda612fb5870716d96d34a6 | 65f48acbe5b4ac06ad4f4c3fed859bfe1932a64b | abhiaiyer91/kots | /cmd/kots/cli/namespace.go | Go | go | 453 | permissive | package cli
import (
"strings"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/util/validation"
)
func validateNamespace(namespace string) error {
if namespace == "" {
return errors.New("namespace is required")
}
if strings.Contains(namespace, "_") {
return errors.New("a namespace should not contain the _... |
1e66540bb5a2fae6bf12065e088f8070a03507ab | 82c4cce2f33b59a42f68caaebf618558a0190a5e | choirudin2210/platform-layer | /errors/errors.go | Go | go | 7,090 | permissive | package errors
import (
"fmt"
"github.com/facebookgo/stack"
"github.com/hailocab/protobuf/proto"
pe "github.com/hailocab/platform-layer/proto/error"
)
const (
ErrorInternalServer = "INTERNAL_SERVER_ERROR"
ErrorBadRequest = "BAD_REQUEST"
ErrorForbidden = "FORBIDDEN"
ErrorBadResponse = "BAD_RESPON... |
08d668fd6eeade8bad6e420d798c2f74da8b6a23 | ea39fdf1a4990f010abe30d8d618559f5a020d82 | shaoyuan1943/ego | /core/util/xtime/xtime_test.go | Go | go | 2,163 | permissive | package xtime
import (
"os"
"reflect"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestDuration(t *testing.T) {
type args struct {
str string
}
tests := []struct {
name string
args args
want time.Duration
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, f... |
ea30ee49138af311fd2d9ef47b33779004ed6373 | d9ba8fa34f79ae9c1f1b04b6dbf8bd2e050d493d | yeya24/leetcode-go | /tests/0389_find_the_difference_test.go | Go | go | 1,209 | permissive | package tests
import (
"reflect"
"testing"
)
/**
* [389] Find the Difference
*
*
* Given two strings s and t which consist of only lowercase letters.
*
* String t is generated by random shuffling string s and then add one more letter at a random position.
*
* Find the letter that was added in t.
*... |
7db6b685e39fe5f821fbaff9f51df55badf56ff8 | efa0ba3b410d3cbb5cffa8798b33b39e6f08c05d | xornet-sl/gosss | /galois/galois.go | Go | go | 4,472 | permissive | /*
Copyright © 2020 Vladimir Sukhonosov. Contacts: founder.sl@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 applicable... |
df94bdd90931c69821269181a19899fa505ad107 | 5f77e5158364952aba3f2ca11609cc58a385cc5e | c-bata/goptuna | /storage_blackhole.go | Go | go | 14,774 | permissive | package goptuna
import (
"errors"
"sync"
"time"
)
var (
// ErrTrialAlreadyDeleted means that trial is already deleted.
ErrTrialAlreadyDeleted = errors.New("trial is already deleted")
// ErrTrialsPartiallyDeleted means that trials are partially deleted.
ErrTrialsPartiallyDeleted = errors.New("some trials are al... |
cffe2681c9d54f0b9adc1aeed926a2c59f69aef4 | 76b409e28804a44435722728e4eaa8b293aac827 | GuanceCloud/datakit | /vendor/github.com/ory/dockertest/v3/docker/pkg/system/lstat_windows.go | Go | go | 412 | permissive | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package system // import "github.com/ory/dockertest/v3/docker/pkg/system"
import "os"
// Lstat calls os.Lstat to get a fileinfo interface back.
// This is then copied into our own locally defined structure.
func Lstat(path string) (*StatT, error) {
... |
af9f98595106f269da5005becaf551fb66cf8238 | b1b70970305151642ae4cb2ffdc4238e2df2ee22 | xxlixin1993/easyGo | /gracefulExit/exit.go | Go | go | 2,146 | no_license | package gracefulExit
import (
"container/list"
"errors"
"strings"
)
var exitList *ExitList
type ExitInterface interface {
// 获取退出程序名
GetModuleName() string
// 退出时需要执行的函数
Stop() error
}
type ExitList struct {
// 退出链表
ll *list.List
// 退出程序名称
module map[string]*list.Element
}
// 初始化退出链表
func InitExitList... |
ac78a4ded37c73d5bbe70b1fc92cb1a61d879632 | 01b864a3006e02466f457b7b963439c51c96c0d0 | Klaven/dex-operator | /pkg/controller/dex/configmap.go | Go | go | 7,299 | permissive | /*
* Copyright 2018 SUSE LINUX GmbH, Nuernberg, Germany..
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by ap... |
edeefce1d7bd74d022d3c98d21c19bd76ff8083c | 25359ff6ba4280c3401d8efc89219750b7469e13 | Richard-Barrett/teleport | /lib/reversetunnel/agent.go | Go | go | 16,036 | permissive | /*
Copyright 2015-2019 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... |
4d98103aca18650e8ce03d47740a4edb941e7a5c | bdb5a121aac1b8b10eec44553374d031224a8461 | youguanxinqing/Goforit | /025/TestUseCpu/main_test.go | Go | go | 354 | no_license | package main
import "testing"
func TestHello(t *testing.T) {
t.Parallel()
if "zhong" != hello() {
t.Fail()
}
t.Log("complete func hello")
}
func TestCalc(t *testing.T) {
t.Parallel()
if 512 != calc() {
t.Fail()
}
t.Log("complete func calc")
}
func BenchmarkHello(b *testing.B) {
hello()
}
func Benchm... |
8012bbecca4a37e2c56371c620a1639a9e8b686a | 2da12532ebb218ebc0ca9bc44946b82e44c4df10 | SemanticBeeng/sourcegraph | /cli/stress.go | Go | go | 8,242 | no_license | package cli
import (
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"net/url"
"os"
"runtime"
"time"
"github.com/dustin/go-humanize"
"github.com/rogpeppe/rog-go/parallel"
"golang.org/x/net/context"
"strings"
"sync"
"sourcegraph.com/sqs/pbtypes"
"sourcegraph.com/sourcegraph/go-flags"
"sourcegraph.com/sou... |
e418b8d359bdee7621a76519479fd71fb967c89e | 702d7b45613e24bec7a31dfefded5beffffd7215 | Thiamath/system-model | /internal/pkg/provider/project/mockup.go | Go | go | 5,416 | permissive | /*
* Copyright 2020 Nalej
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in wri... |
0d90fb1c4671addfeafd17f5980c2c203d25e032 | 54ec3d239908f9ebdb3da40fc13c9d5ccfca3f96 | IMWYY/6.824 | /src/raft/rpc.go | Go | go | 7,355 | no_license | package raft
//
// example code to send a RequestVote RPC to a server.
// server is the index of the target server in rf.peers[].
// expects RPC arguments in args.
// fills in *reply with RPC reply, so caller should
// pass &reply.
// the types of the args and reply passed to Call() must be
// the same as the types of... |
5618ddcf717e07ebdc8bed0c3765d0d175a65386 | c94b1f73e6735b1a954372a9fe858c37b77839d6 | nkgfirecream/cockroach | /kv/send_test.go | Go | go | 18,751 | permissive | // Copyright 2015 The Cockroach 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 ag... |
41583929bed4429e8139ad8ec55b4aa7a988ca9f | 9ec61c5234e854eec1e063d0a9abe4a6aba7391d | loveandpeople/hive.go | /timedexecutor/timedexecutor.go | Go | go | 3,617 | permissive | package timedexecutor
import (
"sync"
"time"
"github.com/loveandpeople/hive.go/timedqueue"
)
// region TimedExecutor ////////////////////////////////////////////////////////////////////////////////////////////////
// TimedExecutor defines a scheduler that executes tasks in the background at a given time. It does... |
250727f1272a32a82d839e13bddb19e30385ef0c | 6a33f7d00fe37495dbd45ff3708d0b38e7121770 | Israel-Ferreira/codebannk | /bank/domain/transaction.go | Go | go | 798 | no_license | package domain
import (
"time"
uuid "github.com/satori/go.uuid"
)
type TransactionRepository interface {
SaveTransaction(txn Transaction, creditCard CreditCard) error
GetCreditCard(creditCard CreditCard) (CreditCard, error)
CreateCreditCard(creditCard CreditCard) error
}
type Transaction struct {
ID ... |
cbb8c694c99781a01a127d38dee1cced80d8332e | f1b3cf06f98d3880aef2412671f4d2f1dbb5657b | haraprasadghosh/emp3r0r | /core/lib/tun/crypto.go | Go | go | 3,732 | permissive | package tun
import (
"crypto/aes"
"crypto/cipher"
"crypto/md5"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"fmt"
"io"
"log"
)
// AESEncryptRaw encrypt bytes
func AESEncryptRaw(key, plaintext []byte) []byte {
block, err := aes.NewCipher(key)
if err != nil {
log.Print(err)
return nil
}
// The IV n... |
c4865621dac00fe03f04abd02b05d10a1a96723e | 355c12c8172f70a4f9a429faca26bd3daa952476 | gabemontero/monitor-jenkins-lifecycle | /vendor/github.com/openshift/origin/pkg/image/controller/scheduled_image_controller.go | Go | go | 6,013 | permissive | package controller
import (
"fmt"
"github.com/golang/glog"
apierrs "k8s.io/apimachinery/pkg/api/errors"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/flowcontrol"
imageapi "github.com/openshift/origin/pkg/image/apis/image"
imageclient "github.com/op... |
529ddad8f8e0b34eb92f0c0454699cdfde1dfc34 | 08e2f20c40c198070f423a31a3c6b9670b5be4df | morezig/go-odoo | /api/base_import_tests_models_char_noreadonly.go | Go | go | 2,248 | no_license | package api
import (
"github.com/morezig/go-odoo/types"
)
type BaseImportTestsModelsCharNoreadonlyService struct {
client *Client
}
func NewBaseImportTestsModelsCharNoreadonlyService(c *Client) *BaseImportTestsModelsCharNoreadonlyService {
return &BaseImportTestsModelsCharNoreadonlyService{client: c}
}
func (svc... |
c52f9e0c4768887096a594f849084211b57d3e2b | 086a9253c730228cde07eaa6bf6b5e45891bfd74 | RTradeLtd/go-ipfs-plugin-i2p-gateway | /vendor/gx/ipfs/QmNScbpMAm3r2D25kmfQ43JCbQ8QCtai4V4DNz5ebuXUuZ/refmt/obj/unmarshalArrayWildcard.go | Go | go | 2,663 | permissive | package obj
import (
"reflect"
. "gx/ipfs/QmNScbpMAm3r2D25kmfQ43JCbQ8QCtai4V4DNz5ebuXUuZ/refmt/tok"
)
type unmarshalMachineArrayWildcard struct {
target_rv reflect.Value
value_rt reflect.Type
valueMach UnmarshalMachine
step unmarshalMachineStep
index int
maxLen int
}
func (mach *unmarshalMachin... |
d613567c3806e3006cf515f01d5b70e7182a3423 | 7edb14ecd690ce188163c1c5c82db2b874b2198f | cbsinteractive/video-transcoding-api | /vendor/github.com/bitmovin/bitmovin-api-sdk-go/analytics/analytics_api.go | Go | go | 1,402 | permissive | package analytics
import (
"github.com/bitmovin/bitmovin-api-sdk-go/common"
)
type AnalyticsApi struct {
apiClient *common.ApiClient
Exports *AnalyticsExportsApi
Impressions *AnalyticsImpressionsApi
Insights *AnalyticsInsightsApi
Metrics *AnalyticsMetricsApi
Ads *AnalyticsAdsApi
Qu... |
830ca48b043cfa78871f3114a9d0530b433117a6 | 0e7a37cbe6a4461dc448dc6e09686a26eca1458c | hackergrrl/go-multiaddr-net | /net_test.go | Go | go | 11,260 | permissive | package manet
import (
"bytes"
"fmt"
"net"
"sync"
"testing"
ma "github.com/jbenet/go-multiaddr-net/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
)
func newMultiaddr(t *testing.T, m string) ma.Multiaddr {
maddr, err := ma.NewMultiaddr(m)
if err != nil {
t.Fatal("failed to construct multiaddr:", m, e... |
4bbb59e794de0a50d652ac76388043e3d62b040e | 2d4a8195c174ed31e9824ec658b857dd553150d7 | functionary/go-quake | /qtype/scalar.go | Go | go | 256 | permissive | package qtype
import "math"
// Float is a 32-bit floating point value.
type Float float32
// Sqrt computes the square root of the value.
func Sqrt(f Float) Float { return Float(math.Sqrt(float64(f))) }
// Int is a 32-bit signed integer.
type Int int32
|
204d1718f7b8560cf0b8a72e5618075b52d483de | 2c03b67ce7656857d44ef94a72b6945bcebf9804 | jgabriel1/golang-auth-service | /src/routes/users.go | Go | go | 1,462 | no_license | package routes
import (
"encoding/json"
"net/http"
"github.com/google/uuid"
"github.com/julienschmidt/httprouter"
)
type usersPostJson struct {
Username string `json:"username"`
Password string `json:"password"`
}
func usersRoutes(router *httprouter.Router, deps *RouteDependencies) *httprouter.Router {
rout... |
ddcc8d902969b067d5ff7a0355876a3d6bf28f3f | 248dff2c485bd99bf4bfc39c2e3133a23e2b84e6 | quite4work/supercronic | /cron/cron.go | Go | go | 6,933 | permissive | package cron
import (
"bufio"
"context"
"fmt"
"io"
"os"
"os/exec"
"strings"
"sync"
"syscall"
"time"
"github.com/aptible/supercronic/crontab"
"github.com/aptible/supercronic/prometheus_metrics"
"github.com/prometheus/client_golang/prometheus"
"github.com/sirupsen/logrus"
)
var (
READ_BUFFER_SIZE = 64 *... |
f04d62c7aee921e15487ee8a7e306b04036eb50b | b77005f62db198580f15ab0fc2d48a039d6fb8fd | jwongz/tidb-binlog | /tests/dailytest/case.go | Go | go | 15,131 | permissive | // Copyright 2019 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... |
3cd47a8ecb765d815037b05a8d7710e77a4f1f52 | 200d76461a60b9e74950a1c1802743e2990eebc4 | he583899772/jack | /model/post.go | Go | go | 665 | no_license | package model
import (
"github.com/jinzhu/gorm"
uuid "github.com/satori/go.uuid"
)
type Post struct {
ID uuid.UUID `json:"id" gorm:"type:char(36);primary_key"`
UserId uint `json:"user_id" gorm:"not null"`
CategoryId uint `json:"category_id" gorm:"not null"`
Category *Category
Title string `json:"title" gorm:... |
ef3a7c9427a1af4c5d9673845e8d50a1000822e4 | d2507413b22d929432d700e2298d5b6808c188a9 | astrieanna/rkt | /store/store.go | Go | go | 21,492 | permissive | // Copyright 2014 The rkt 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... |
03f8ffca871f928a14cccc14885cf2373e8a0a05 | 886514476fae0166d7ca1661e990ca1032100663 | linger2334/pitaya | /service/handler.go | Go | go | 11,200 | permissive | // Copyright (c) nano Author and TFG Co. All Rights Reserved.
//
// 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, cop... |
4a2ebfcc3fadd0113483d3eb84ecf496469176ae | a1d62b209b18ecead62ccaae1d51358495f57b3e | airbnb/istio | /pilot/pkg/leaderelection/k8sleaderelection/healthzadaptor_test.go | Go | go | 5,445 | permissive | /*
Copyright 2015 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, ... |
c25a641532aefaea851db8df4eb55049ec2bbf27 | a38cc2507b5055bb1ac92edd92bc0a1005f70306 | sharadkhoji123/golang002 | /ServeMutex/01_routing/main.go | Go | go | 429 | no_license | package main
import (
"io"
"net/http"
)
type hotdog int
func (h hotdog) ServeHTTP(w http.ResponseWriter, req *http.Request) {
switch req.URL.Path {
case "/dog":
io.WriteString(w, "Wuff Wuff Wuff!!!")
case "/cat":
io.WriteString(w, "Miaooo Miaooo Miaooo!!!")
default:
io.WriteString(w, "<h1>Welcome to the ... |
79bda8c55d0f0e6676b8b93c64b6a08f070b3ec4 | 4ad857bf8de3afaa6b1b46cc7afd580349dd37d0 | canerdogan/bosun | /_third_party/golang.org/x/oauth2/google/sdk.go | Go | go | 5,352 | permissive | // Copyright 2015 The oauth2 Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package google
import (
"encoding/json"
"errors"
"fmt"
"net/http"
"os"
"os/user"
"path/filepath"
"runtime"
"strings"
"time"
"bosun.org/_third_p... |
d5baf1af6a003090f53f24d63bbafbe3dd976d54 | eab2cb859dfb67de8119d74bf5088aa80ed9866e | Eadinator/flux2 | /cmd/flux/create_secret_git.go | Go | go | 6,222 | permissive | /*
Copyright 2020 The Flux 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, softwar... |
5b74d89ddaa48ac626a5693ea23192f0fd246005 | 0d2c25d496ae23825c5016cc2ef8389751a42ed8 | RMHAM/network_scanner | /snmp_arp_discover.go | Go | go | 3,029 | permissive | //ben@kc2vjw.com
package main
import (
"time"
"fmt"
// "log"
"os"
"strings"
"net"
"flag"
"github.com/soniah/gosnmp"
)
var hosts map[string]int
func main() {
entrypoint := flag.String("e", "entrypoint", "First host to query")
community := flag.String("c", "public", "SNMP community string")
devdb := flag.St... |
88b4e2e5ccb1339daae698512caaceb1dfd99272 | a8002bfc751d40a666bad21018306164745fd45a | 193792768lyw/study-2021 | /go101/main.go | Go | go | 264 | no_license | package main
import "fmt"
func main() {
var dd interface{} = ""
if dd == "" {
fmt.Println("Dvfsb")
}
//s := [...]struct{ age int }{
// {44}, {55}, {66},
//}
//
//for _, v := range s {
// fmt.Println(v)
// s[1].age = 8888
//}
//fmt.Println(s)
}
|
c785c56ccd25abeff42fe40a3000bf13a8861116 | 34ca797897f00d81c7abcb55f7a018c200c147c0 | zaf/go2c | /go2c.go | Go | go | 3,535 | permissive | /*
Example of interfacing between Go and C programs.
Copyright (C) 2017, Lefteris Zafiris <zaf@fastmail.com>
This program is free software, distributed under the terms of the MIT License.
See the LICENSE file at the top of the source tree.
*/
// Package should be called main and 'C' should always be imported
pack... |
c5947824e061e0cc9fac97097019ef4db99043ae | 2ad8c75908e2b54aa34c6a7292223070b2eebf3a | r4b3rt/elastic | /recipes/search_with_point_in_time/search.go | Go | go | 3,092 | permissive | // Copyright 2012-present Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
// Search illustrates how to search using the Point in Time API.
//
// Example
//
// Scroll through an index called "products".
//
// ... |
cb5af30094bf78a7faa2eca0ab8129d1eb56a830 | 494225c0c46f07ff7e55dc59dea29d18237d8913 | MatrixDeity/Problems | /LeetCode_2439/main.go | Go | go | 310 | no_license | /**
LeetCode_2439
https://leetcode.com/problems/minimize-maximum-of-array/
MatrixDeity, 2023.
*/
package leetcode2439
func minimizeArrayValue(nums []int) int {
res, sum := 0, 0
for i, num := range nums {
sum += num
avg := (sum + i) / (i + 1)
if avg > res {
res = avg
}
}
return res
}
|
87218bbe7cc1111955a4f91943c0f431e1bc4ce7 | ee2ae4625cf98c1d1ee4b5a1a9f14da69f46ca74 | openshift-ci-robot/origin | /pkg/network/node/ovscontroller_test.go | Go | go | 38,892 | permissive | // +build linux
package node
import (
"fmt"
"reflect"
"sort"
"strings"
"testing"
networkapi "github.com/openshift/origin/pkg/network/apis/network"
"github.com/openshift/origin/pkg/util/ovs"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kapi "k8s.io/kubernetes/pkg/api"
)
func setupOVSController(t *testing.... |
2301b656e0c8dea4143fe7e1e591ccf620482236 | 54ba4a7cb6aa1b2f20d0d61d6ce13e315adece64 | chenyuanqi/note | /backend/go/reborn/project/blog/pkg/pagination/pagination.go | Go | go | 4,610 | permissive | package pagination
import (
"blog/pkg/config"
"blog/pkg/types"
"math"
"net/http"
"strconv"
"strings"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
// Page 单个分页元素
type Page struct {
// 链接
URL string
// 页码
Number int
}
// ViewData 同视图渲染的数据
type ViewData struct {
// 是否需要显示分页
HasPages bool
// 下一页
Next Pag... |
bd92de14fa373d7fcd3224c80ccd7c55e9097b87 | 84768de3bc0a14537581d5547d21e8526707daa3 | kim-hangyeol/Public_OpenMCP | /portal-api-server/repo.go | Go | go | 731 | permissive | package main
import "fmt"
var currentId int
var todos Todos
// Give us some seed data
func init() {
RepoCreateTodo(Todo{Name: "Write presentation"})
RepoCreateTodo(Todo{Name: "Host meetup"})
}
func RepoFindTodo(id int) Todo {
for _, t := range todos {
if t.Id == id {
return t
}
}
// return empty Todo i... |
7560f074983d8249ac78f117da2b400aa9458661 | 8371ff15da27687b97d3a8dbc10fb00e6a203b45 | openshift/installer | /terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/parse/monitor_aad_diagnostic_setting.go | Go | go | 1,469 | permissive | package parse
import (
"fmt"
"strings"
"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids"
)
const aadDiagnosticSettingIdPrefix = "/providers/Microsoft.AADIAM/diagnosticSettings/"
var _ resourceids.Id = MonitorAADDiagnosticSettingId{}
type MonitorAADDiagnosticSettingId struct {
Name string
}
f... |
abaed51d00bc47fcd2335b63b49f5680f700d8ac | 1c9a37ed664f29ecfaa9dcc7b235c4d469ac3269 | tullur/swi | /source/model/xml.go | Go | go | 360 | no_license | package model
import "encoding/xml"
// XMLObject desribe xml Object node
type XMLObject struct {
XMLName xml.Name `xml:"object"`
ObjectName string `xml:"obj_name"`
Fields []XMLField `xml:"field"`
}
// XMLField describe xml Field node
type XMLField struct {
Name string `xml:"name"`
Type string `xm... |
590d664bc13fe611de30c4c2ff268c6297bfd3e9 | e0ecc2bc418df1d0c0cf66cc8fc4500e341c20b8 | plin2k/go-helper | /map.go | Go | go | 4,198 | permissive | package go_helper
// KEYS AND VALUES
// map[string]string
func MapSSKeys (input map[string]string) []string {
var keys = make([]string,0,len(input))
for key,_ := range input{
keys = append(keys, key)
}
return keys
}
// map[string]string
func MapSSValues (input map[string]string) []string {
var values = make([... |
983ab5c90ab4073621dd0900eb56dc8422f96b9e | 2c4b143b0c5395ec94f51a432a1037a80947c4ef | jdcloud-api/jdcloud-sdk-go | /services/apigateway/apis/CreateAccessAuth.go | Go | go | 3,168 | 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 ... |
6f38add60d3eca1edaecabe7b6868208325adabc | 562e2da979f6594251cd7ae844e3e3e700ede25a | obokaman-com/krakend-ce | /sd.go | Go | go | 937 | permissive | package krakend
import (
"context"
"fmt"
consul "github.com/devopsfaith/krakend-consul"
"github.com/luraproject/lura/config"
"github.com/luraproject/lura/logging"
"github.com/luraproject/lura/sd/dnssrv"
)
// RegisterSubscriberFactories registers all the available sd adaptors
func RegisterSubscriberFactories(ct... |
5717840e95b1fc1ece4a8ce220aa6ebbe745da4b | 5ed107ce58aa0b1382f3e234421f90c9b665bc61 | aknysh/ply | /types/ply.go | Go | go | 14,432 | permissive | package types
import (
"go/ast"
"go/constant"
"go/token"
)
// A plyId is the id of a ply function or method.
type plyId int
const (
// funcs
_Max plyId = iota
_Merge
_Min
_Not
_Zip
// methods
_All
_Any
_Contains
_DropWhile
_Filter
_Fold
_Morph
_Reverse
_TakeWhile
_ToSet
)
var predeclaredPlyFuncs... |
6861c737be8b35e327a5807266bbee42f8f93830 | dcf580c8ed7f38baefd12dc99521be3b394e014a | FlorianBergmann/gosoline | /test/guard/fixtures_test.go | Go | go | 2,355 | no_license | // +build integration,fixtures
package guard_test
import "github.com/applike/gosoline/pkg/fixtures"
func buildPolicies() []interface{} {
return []interface{}{
fixtures.MysqlPlainFixtureValues{"a97b104f-4d93-4c15-a97a-4e3173e75cde", "global - read and write access", "allow"},
fixtures.MysqlPlainFixtureValues{"18... |
ed0809ab2c5dc5ac532ab90b07be8bdfd364400b | e29d3c673fd2d67cf1f1e1c6f53f32ce26b01c1b | fly-potato-100/kiteq | /handler/accept_event.go | Go | go | 2,926 | no_license | package handler
import (
"errors"
"fmt"
"github.com/blackbeans/kiteq-common/protocol"
"github.com/blackbeans/kiteq-common/stat"
"github.com/blackbeans/kiteq-common/store"
log "github.com/blackbeans/log4go"
"github.com/blackbeans/turbo"
"os"
"time"
)
//--------------------如下为具体的处理Handler
type AcceptHandler st... |
295aa3e68f8d7346c3e2d836f038b6959a0f9869 | 589988874c23b7d3b9d5d0e1fc41dbaf0a2986a2 | ReevooQuiz/Sofia | /backend/qa-service/rpc/UsersRPCImpl.go | Go | go | 1,723 | permissive | package rpc
import (
"encoding/json"
"github.com/SKFE396/qa-service/config"
"io/ioutil"
"net/http"
"strings"
)
type UsersRPCImpl struct {
usersRPC UsersRPC
}
func (u *UsersRPCImpl) GetUserInfos(uids []int64) (result []UserInfo, err error) {
var requestBody struct {
Uids []int64 `json:"uids"`
}
requestBody... |
7624bbf154bce36c256f742bead21e581594a677 | e1bc3aa81a0cbd19059e2b95bc59c8a265a579c9 | zuxingyu/origin | /test/integration/storage_versions_test.go | Go | go | 7,660 | permissive | package integration
import (
"fmt"
"path"
"testing"
etcd "github.com/coreos/etcd/client"
"github.com/coreos/etcd/clientv3"
"golang.org/x/net/context"
batch_v1 "k8s.io/api/batch/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/run... |
a3f351c9c2b8222b32f1d263d3006196639f81bc | 964ad635e65c21cfd90187dd648f970ba29b11d9 | VellichorLK/emotibot-admin-api | /module/token-auth/internal/data/role.go | Go | go | 474 | permissive | package data
type Role struct {
UUID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Privileges map[string][]string `json:"privileges"`
UserCount int `json:"user_count"`
}
type Module struct {
ID i... |
4ecd3ab909385f17c2ca9cb37dd844b1bf475712 | 890ee2235e6929381d0faac0580664414321f9ab | obasajujoshua31/go-todo-api-caching | /server/services/postgres.go | Go | go | 561 | no_license | package services
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
"go-todo-api-caching/config"
)
type DB struct {
*gorm.DB
}
func ConnectToDB(connString string, driver string) (DB, error) {
db, err := gorm.Open(driver, connString)
if err != nil {
return DB{}, err
}
re... |
7fb34edd5293fb6f41214cdcb9c817849263adae | f9417d36d7d1b79a1d0301e3472a923eba8b8c90 | seuf/gonsx | /api/securitypolicy/securitypolicy_types_functions.go | Go | go | 7,766 | permissive | package securitypolicy
import (
"encoding/xml"
"errors"
"fmt"
)
func (sp SecurityPolicy) String() string {
return fmt.Sprintf("SecurityPolicy with objectId: %s", sp.ObjectID)
}
// MarshalToXML converts the object into XML
func (sp SecurityPolicy) MarshalToXML() string {
xmlBytes, _ := xml.Marshal(sp)
return st... |
3ac3c51d01d7d5950e345222197fe48e1b85ee78 | 7859b46d5103b79acd63d9bb595d8ed32079c74c | PiotrLuczko/epsagon-go | /example/sqs_trigger/hello/main.go | Go | go | 1,536 | permissive | package main
import (
"fmt"
"log"
"os"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sqs"
"github.com/epsagon/epsagon-go/epsagon"
"github.com/epsagon/epsagon-go/wrappers/aws/aws-sdk-go/aws"
)
func myHan... |
384fbea4cb37ae7eb496d1c9475c90449b3b2c19 | 2a06bed2f65c9880ba341ae66ca0f84f1befb059 | ethereum-optimism/chainlink | /core/services/eth/contracts/FluxAggregator.go | Go | go | 3,167 | permissive | package contracts
import (
"math/big"
"github.com/smartcontractkit/chainlink/core/services/eth"
"github.com/smartcontractkit/chainlink/core/store/models"
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
)
//go:generate mockery --name FluxAggregator --output ../../../internal/mocks/ --case=under... |
2b22e02b58edc11eec49b5a9705d070b187e3473 | f291abf99fd80ffee916356b679fdeb2224626f3 | abdasgupta/origin | /vendor/github.com/openshift/apiserver-library-go/pkg/securitycontextconstraints/sccadmission/scc_exec_test.go | Go | go | 3,888 | permissive | package sccadmission
import (
"context"
"testing"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apiserver/pkg/admission"
"k8s.io/apiserver/pkg/authentication/user"
"k8s.io/client-go/kubernetes/fake"
clientgotesting "k8s.io/client-go/testin... |
9301d91ad8720b5acf1f6e1262e1dd6b4c08943b | 041da60b2796129d3e0d87012920a41045358c51 | Mothergoose31/chat | /chatFolder/backend/private_message.go | Go | go | 634 | no_license | package main
import (
"encoding/json"
"errors"
"strings"
)
func Unpack(data string) (string, []byte, error) {
result := strings.SplitN(data, " ", 2)
if len(result) != 2 {
return "", nil, errors.New("Unable to extract event name from data.")
}
return result[0], []byte(result[1]), nil
}
func... |
a6bbc54d4a1e1fc3be23f62a6d9ad78c727cf86d | 7ffdcb042721239e9d31b2a8fa6058e8632dbccb | perekalov/wal-g | /internal/compression/brotli/decompressor.go | Go | go | 551 | permissive | // +build brotli
package brotli
import (
"io"
"github.com/google/brotli/go/cbrotli"
"github.com/wal-g/wal-g/internal/compression/computils"
"github.com/wal-g/wal-g/utility"
)
type Decompressor struct{}
func (decompressor Decompressor) Decompress(dst io.Writer, src io.Reader) error {
brotliReader := cbrotli.Ne... |
0012cb97bebec04379084b1a3e395ae9cf12d48b | fd39f108a8ef37afd73555a51e874fe0d95f54fb | H1d3r/fibratus | /pkg/filament/kdict.go | Go | go | 3,904 | permissive | //go:build filament && windows
// +build filament,windows
/*
* Copyright 2019-2020 by Nedim Sabic Sabic
* https://www.fibratus.io
* 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 ... |
c9c89aeb5c63bc6949670b37987cfddebf2bda44 | 73c421bc40317e00451559f938fba8c02068cdfc | wzhtwr/agi | /cmd/gapit/profile.go | Go | go | 2,321 | permissive | // Copyright (C) 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
00a8a240063510be4f0868336f8517c056d38a8c | 4aef532a234a837b6b21366316cfb3410a50f02b | mohan08p/Competitive_Programming | /HackerRank/All Domains/Algorithms/Warmup/Time Conversion/solution.go | Go | go | 403 | no_license | package main
import "fmt"
func main() {
//Enter your code here. Read input from STDIN. Print output to STDOUT
var str string
fmt.Scanf("%s",&str)
val:=(str[0]-'0')*10+(str[1]-'0')
if str[8]=='A' {
if val==12 {
val=0
}
} else {
val+=12
if val==24 {
... |
9a2ce0fc34e2f630d8166eabb9d687eb3ab99b81 | f3f387cbe64e566f91cd067a9fa425901386dd6a | limkokholefork/probe-cli | /nettests/im/whatsapp.go | Go | go | 1,691 | permissive | package im
import (
"github.com/ooni/probe-cli/nettests"
"github.com/ooni/probe-engine/experiment/whatsapp"
)
// WhatsApp test implementation
type WhatsApp struct {
}
// Run starts the test
func (h WhatsApp) Run(ctl *nettests.Controller) error {
experiment := whatsapp.NewExperiment(ctl.Ctx.Session, whatsapp.Confi... |
d02567649377a6783fd0854decb0daea0134b5cf | 7f3584fb3a8f80aa54c1d031474d50b41d9bc415 | lzp9421/lazygo | /utils/errors.go | Go | go | 574 | permissive | package utils
// CheckError 如果err != nil 记录日志
func CheckError(err error) {
if err != nil {
Warn(err.Error())
}
}
// CheckFatal 如果err != nil 记录日志并panic
func CheckFatal(err error) {
if err != nil {
Error(err.Error())
panic(err)
}
}
// Go 安全的goroutine
func Go(callback func()) {
go func() {
defer func() { /... |
1baf26edc7f1b2ca22e14dbed35cd59685f76db2 | 49851a0613df6df8348ef58a95829934a80d1e4b | fantastic-people/go | /maze.go | Go | go | 489 | no_license | package main
import (
"fmt"
"os"
)
func readMaze(filename string) [][]int{
file,err:=os.Open(filename)
if err!=nil{
panic(err)
}
var row ,col int
fmt.Fscanf(file,"%d %d",&row,&col)
maze:=make([][]int,row)
for i:= range maze{
maze[i]=make([]int,col)
for j:= range maze[i]{
fmt.Fscanf(file,"%d",&maze[i]... |
61ad60d88a20fa7dda9b346b76a667a672aad3ea | 0c36eac331a48c4d49a6a06fe91ffc4cac233ca7 | weiyiming1/CodingInterview | /temp/数的最大高度.go | Go | go | 526 | no_license | package main
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
func maxDepth(root *TreeNode) int {
if root == nil {
return 0
}
return max(maxDepth(root.Left), maxDepth(root.Right)) + 1
}
func max(x, y int) int {
if x >= y {
return x
}
return y
}
// max(maxDepth(9), maxDep... |
99cc94a308ef7f41ef57ec97181ad65f2420a3ee | 29624615d8b3370b1d09538b63442809f2af9045 | google/kctf | /kctf-operator/main.go | Go | go | 3,912 | permissive | /*
Copyright 2022.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed un... |
b08195517a2ee3240071290a87215592cd3ba6c2 | 0e9d2cb13c92e2c5d048611f0fa917e08338a4a2 | giorgos-nikolopoulos/adc-nitro-go | /resource/config/xm/xmdeployment.go | Go | go | 1,040 | permissive | /*
* Copyright (c) 2021 Citrix Systems, 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 ... |
039a7697c58014875b7bfaf19073ecd7c39e04ac | d18aeaa680a85d5f2efbf16a5bbc11bbbd15ebd1 | sapcc/ipmi_exporter | /collector_chassis.go | Go | go | 1,748 | permissive | // Copyright 2021 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... |
ae61ddb1b9614cf8fd178bef663a66519b204938 | 6b6713d6a783908dc0584e248c3600917ec68736 | dave/golib | /src/cmd/compile/internal/wasm/package-state.go | Go | go | 535 | permissive | package wasm
type PackageState struct {
gc *gc.PackageState
obj *obj.PackageState
ssa *ssa.PackageState
types *types.PackageState
wasm *wasm.PackageState
}
func NewPackageState(gc_pstate *gc.PackageState, ssa_pstate *ssa.PackageState, types_pstate *types.PackageState, obj_pstate *obj.PackageState, wasm_p... |
a9a40d03664a5c33a4dc77bcf383e1f4612aeb9d | c55120369df98e483678090c2093bc84e4552b53 | shiyibo/tidb | /infoschema/tables.go | Go | go | 110,560 | permissive | // Copyright 2016 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... |
a9c5c4b775af8349aa4bdba58be9dcba6aacf18e | f52c18afec2b262708939d22fc43019259e474ab | renovate-testing/test-9748-google-cloud-go | /internal/generated/snippets/securitycenter/apiv1p1beta1/Client/UpdateOrganizationSettings/main.go | Go | go | 1,431 | permissive | // Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.