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 |
|---|---|---|---|---|---|---|---|---|
c1ff27c7729f02a26cc6dd37a4c8f74c4b7d8ec9 | b0a42de12ff0cff9fcf733bf97a030a0eb8fa920 | sharpevo/synthesis | /internal/instruction/controlflow.negoto.go | Go | go | 1,031 | no_license | package instruction
import (
"fmt"
"synthesis/internal/dao"
"synthesis/internal/interpreter/vrb"
"strconv"
)
func init() {
dao.InstructionMap.Set("NEGOTO", InstructionControlFlowNotEqualGoto{})
}
type InstructionControlFlowNotEqualGoto struct {
InstructionControlFlowGoto
}
func (i *InstructionControlFlowNotEq... |
55eaa4921c73877c6db18d0e7c3a840a826b0a91 | 2cc2d5674f12522f865794dc062088a278145e29 | filipegorges/go-pipelines-presentation | /basic_syntax/main.go | Go | go | 883 | no_license | // START 1 OMIT
package main // HL
import "fmt" // HL
type Presenter interface { // HL
Introduce()
}
type Language struct { // HL
Name string
Maintainer string
Motivations []string
}
func NewLanguage(name, maintainer string, motivations []string) *Language { // HL
return &Language{
Name: name,... |
e3a7d58b0108b5137e4c2ca1cda2aa85299d69e4 | 1f0fe132ee4fd8f28a2f6b41e9c7bfb06e9085f7 | Phuong39/examples_golang | /executable-file/signverify/main.go | Go | go | 2,351 | no_license | package main
import (
"bytes"
"crypto/sha256"
"flag"
"fmt"
"io/fs"
"io/ioutil"
"os"
"path/filepath"
"strings"
"./filetype"
"./signer"
)
var (
action = flag.String("action", "", "avaliable action: sign、verify")
dir = flag.String("dir", "", "the directory path")
file = flag.String("file", "", "the f... |
072a5695a4f18aaf4ce807b65dc462c6b7c71fce | 8f718ea94efb63ef51cf0b82ac82c8a6adee39ec | cloudfoundry/bosh-agent | /platform/disk/linux_formatter_test.go | Go | go | 12,048 | permissive | package disk_test
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"errors"
"fmt"
. "github.com/cloudfoundry/bosh-agent/platform/disk"
fakesys "github.com/cloudfoundry/bosh-utils/system/fakes"
)
var _ = Describe("Linux Formatter", func() {
Describe("Format", func() {
Context("when using sw... |
71c19912bd3dd2c4c8afa7e2e8decf9ea6d2205a | e6a15aeb17682325064a4337aaa8571932ee1764 | RonadoLong/shop-web | /module/goods/service/GoodsNavService.go | Go | go | 873 | no_license | package service
import (
"github.com/gin-gonic/gin"
"shop-web/common/dbutil"
"shop-web/module/goods/model"
"shop-web/common/commonUtils"
"shop-web/module/goods/protocol"
)
func (*goodsService)FindGoodsNavList(c *gin.Context) {
var goodsNavList []model.GoodsNav
if err := dbutil.DB.Table("goods_nav").Where(... |
fd9b645960b7544a0713a7e041eae620d6d7e87d | 469347f94c23bd905591c2ee3771e6f8ee9eb55e | Kevintjeb/KaraokeJam | /backend/queue/queueservice.go | Go | go | 3,541 | permissive | package main
import (
"context"
"log"
"time"
"github.com/mongodb/mongo-go-driver/bson"
"github.com/mongodb/mongo-go-driver/mongo"
)
type Track struct {
ID string `json:"id,omitempty" bson:"id"`
Name string `json:"name,omitempty" bson:"name"`
Artist []Artist `json:"artist,omitempty" bson... |
f027fc4ab989ee69a484de7a8b7dd60e2f85dad1 | 4af4629ebbddcc14df2ee05790e360ee2a2e398f | Mattlk13/oci-go-sdk | /datasafe/list_target_databases_request_response.go | Go | go | 14,277 | 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... |
662db6e382c7558c0b7213014de971eb26b367c9 | e2352574fbbbc4bf0b3e579296da0d15d49c2bef | lucasallan/godotto | /internal/ottoutil/jsvendor/corejs/corejs_test.go | Go | go | 499 | permissive | package corejs
import (
"testing"
"time"
"github.com/aybabtme/godotto/internal/vmtest"
"github.com/robertkrimen/otto"
)
func TestLoad(t *testing.T) {
opt := func(vm *otto.Otto) error {
start := time.Now()
err := Load(vm)
t.Logf("loaded in %v", time.Since(start))
return err
}
vmtest.Run(t, nil, `
var m... |
ffd14056e30c90f6ffd5c84dcdd842970bdc6940 | 60c5f1f8e4ceb414e57ca24e2b02f91682e326d2 | smm-goddess/leetcode | /200-numislands/200.number-of-islands_test.go | Go | go | 466 | permissive | package numislands
import (
"testing"
)
func TestNumIslands(t *testing.T) {
grid := [][]byte{
{'1', '1', '1', '1', '0'},
{'1', '1', '0', '1', '0'},
{'1', '1', '0', '0', '0'},
{'0', '0', '0', '0', '0'}}
if numIslands(grid) != 1 {
t.Error("First Error")
}
grid = [][]byte{
{'1', '1', '0', '0', '0'},
{... |
76358fe7459e24f157c24da06c287240e770d5ff | ed645d1c8c1d954c20a0b4b3c842210764d0c406 | velebak/pandik | /checker.go | Go | go | 322 | no_license | package main
import (
"net/http"
)
type Checker func(*MonitorConf) (bool, error)
func checkHTTPStatus(mc *MonitorConf) (bool, error) {
resp, err := http.Head("http://" + mc.Url)
if err != nil {
return false, err
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return false, nil
}
return true, nil
... |
b9d16292a5f1e812a4b5bf9648bf437bad689f4c | c9a89f4ee60f63da7fa90ef30afd3f04f69f7f18 | MOZGIII/dockertest | /docker_test.go | Go | go | 1,364 | no_license | package dockertest
import (
"net"
"strconv"
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestParsePorts(t *testing.T) {
c := Container{}
c.parsePorts("")
require.NotNil(t, c.ports)
require.Len(t, c.ports, 0)
c.parsePorts("6379/tcp -> 0.0.0.0:32815")
require.NotNil(t, c.ports)
require.... |
c932f817af020072bbaf265f7298a09d09b33375 | b3ed72b6f7ab5f5ba9348191e07c6d808dca7c79 | PaaS-TA/PaaS-TA-Core | /paasta-container/src/code.cloudfoundry.org/cfhttp/cf_http.go | Go | go | 2,560 | permissive | package cfhttp
import (
"crypto/tls"
"crypto/x509"
"errors"
"fmt"
"io/ioutil"
"net"
"net/http"
"sync/atomic"
"time"
"code.cloudfoundry.org/cfhttp/unix_transport"
)
var SUPPORTED_CIPHER_SUITES = []uint16{
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
}
var config C... |
964de5a3ecaa24cc117e36606a91682ac814a18b | 8d5c59c18ed9053e0c6e150b2a782e182b351635 | i96751414/libtorrent-go | /libtorrent_cgo.go | Go | go | 620 | permissive | package libtorrent
// #cgo pkg-config: --static libtorrent-rasterbar openssl
// #cgo CXXFLAGS: -std=c++11
// #cgo darwin CXXFLAGS: -fvisibility=hidden -fvisibility-inlines-hidden
// #cgo darwin LDFLAGS: -lm -lstdc++ -framework CoreFoundation -framework SystemConfiguration
// #cgo !android,linux CXXFLAGS: -I/usr/includ... |
8de4161bc0700b7545b590d1490da20a878f8718 | e824e74e2f77add4d38ed91c0016f4f6bfbf52a6 | go-lsst/fcs-lpc-motor-ctl | /plots.go | Go | go | 4,060 | permissive | // Copyright ©2016 The go-lsst 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 main
import (
"bytes"
"encoding/binary"
"fmt"
"image/color"
"image/color/palette"
"math"
"time"
"go-hep.org/x/hep/hplot"
"gonum.org/v1/... |
624f3a4d1f2612c8fc041b7eb10f19429a1c774b | 7be4e75ea167100eeb302ac22eabbf01aa0adc74 | kunal-kushwaha/thanos | /pkg/block/index_test.go | Go | go | 2,402 | permissive | // Copyright (c) The Thanos Authors.
// Licensed under the Apache License 2.0.
package block
import (
"context"
"io/ioutil"
"os"
"path/filepath"
"testing"
"github.com/go-kit/kit/log"
"github.com/prometheus/prometheus/pkg/labels"
"github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/tsdb/... |
33692bfa3452892c33999afd38d8db51c29c7531 | 73afd01fa60452ec27c24de1cb101048d39bb765 | solidnerd/terraform-provider-harbor-1 | /harbor/resource_tasks.go | Go | go | 4,026 | no_license | package harbor
import (
"fmt"
"log"
"strings"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/nolte/terraform-provider-harbor/client"
"github.com/nolte/terraform-provider-harbor/gen/harborctl/client/products"
"github.com/nolte/t... |
66ed7a6a83c7c8ae251de956545629c8caa1a541 | a774346a83d01c9fe55b101870a7d56f7b07c044 | mark77z/gogsClone | /models/repo_collaboration.go | Go | go | 4,810 | permissive | // Copyright 2016 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package models
import (
"fmt"
)
// Collaboration represent the relation between an individual and a repository.
type Collaboration struct {
ID int64 ... |
937b060293602ba9584275bb977f11f72e561a0f | 437321bcc8b2133fdcf51de174215f43b76ec239 | weiiqi/myleetcode | /51.go | Go | go | 1,893 | no_license | package main
/*
思路一: 回溯算法
时间复杂度: O (n!) 第一行有N个选择,第二行有n-1个选择,一次类推,为N!
空间复杂度: O(4n)
1。 递归深度最大为N
2。 存放列数据, 存放左对角线,存放右对角线,最大都为N空间
3。 和为4N,简化为O(n)
*/
func solveNQueens(n int) [][]string {
ret := make([][]string, 0)
queens := make([]int, 0)
for i := 0; i < n; i++ {
queens[i] = -1
}
colums := map[int]bool{}
diagon... |
5d9f8204213ca89549648436809bc0a3cd78df73 | e1e3c78ae896ee76d6d02d3493a808df12f153ae | kolkov/kassar | /app/transactional.go | Go | go | 1,148 | no_license | package app
import (
"github.com/go-ozzo/ozzo-routing/fault"
"github.com/go-ozzo/ozzo-dbx"
"github.com/go-ozzo/ozzo-routing"
)
// Transactional returns a handler that encloses the nested handlers with a DB transaction.
// If a nested handler returns an error or a panic happens, it will rollback the transaction.
//... |
32171d10005846122094eab36d2335ce25d64f6e | 945e3765c9d1b0e6fa4ef74c609f8d11e9859958 | kubedb/apimachinery | /apis/catalog/v1alpha1/pgbouncer_version_helpers.go | Go | go | 1,839 | permissive | /*
Copyright AppsCode Inc. and Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing... |
a137b5f9e2fde0ecd835b732c52e6182c0bf3024 | 890a3c54cc5c06d58275560e6928bac3b2a870ae | decker502/go2o | /src/core/repository/member_rep.go | Go | go | 10,567 | permissive | /**
* Copyright 2014 @ z3q.net.
* name :
* author : jarryliu
* date : 2013-12-09 10:13
* description :
* history :
*/
package repository
import (
"database/sql"
"fmt"
"github.com/jsix/gof"
"github.com/jsix/gof/db"
"github.com/jsix/gof/log"
"go2o/src/core/domain/interface/member"
"go2o/src/core/domain/in... |
7be9e564f7eb84fbabe38a2c0ed7b107d6b36d30 | 57713ccf66669deddf396f6ef0266b07a098c30d | tebo-ernstberger/go-sudoku-solver-api | /internal/sudoku/routes.go | Go | go | 554 | no_license | package sudoku
import (
"net/http"
)
// Routes defines all our routes
func (s *Server) Routes() {
s.Router.Path("/sudoku").Methods("GET").
HandlerFunc(corsHandler(s.handleRandomGrid()))
}
func corsHandler(h http.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("... |
2692e1c8e53d8fbaf66074cfcc9744599cecf6b4 | cbb375f6416ab0af4c2f8d11e44cf57bec5782ce | xav-b/stacks | /grpc/servers/main.go | Go | go | 713 | no_license | package main
import (
"log"
"net"
"github.com/hackliff/grpc/generated/stdlib"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
const (
port = ":50051"
)
type server struct{}
// NOTE how to use ctx ?
func (s *server) SimpleSync(ctx context.Context, in *stdlib.Foo) (*stdlib.Bar, error) {
log.Printf("proc... |
270617f9ca9100277f4c6d6c8205bcad1772b7a0 | f60e4d67f8ae9b9a48ce262e9fd41a8a3567a19e | henly2/hello-go | /zyh_test/test78_接口继承.go | Go | go | 423 | no_license | package main
import "fmt"
type Humaner0 interface {
sayhi()
}
type Personer interface {
Humaner
sing(lrc string)
}
type Student003 struct {
name string
id int
}
func (tmp *Student003) sayhi() {
fmt.Println(tmp.name, tmp.id)
}
func (tmp *Student003) sing(lrc string) {
fmt.Println(lrc)
}
func main() {
//定义接... |
81d4b69a14d62ecfda1aadc42b5c31e5084a4845 | fb0c5dee65aa13e531d632806630888838439c2c | seriousgong/leetcodedaily | /year2021/m7/8.go | Go | go | 355 | permissive | package m7
func numSubarraysWithSum(nums []int, goal int) int {
res, sum1, sum2, l1, l2 := 0, 0, 0, 0, 0
for i := 0; i < len(nums); i++ {
sum1 += nums[i]
sum2 += nums[i]
for ; l1 < len(nums) && sum1 > goal; l1++ {
sum1 -= nums[l1]
}
for ; l2 < len(nums) && sum2 >= goal; l2++ {
sum2 -= nums[l2]
}
... |
15024150d06be3a93bae5b7b79a422762aa6c073 | 4e0673e793a2e4edbdde40024ca36b91998d5b6c | cpinsights/sourcegraph | /internal/usagestats/retention_test.go | Go | go | 2,887 | permissive | package usagestats
import (
"context"
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/sourcegraph/sourcegraph/cmd/frontend/types"
"github.com/sourcegraph/sourcegraph/internal/db"
"github.com/sourcegraph/sourcegraph/internal/db/dbconn"
"github.com/sourcegraph/sourcegraph/internal/db/dbtesting"
)
f... |
fea2555d1844364cb0832a829e1bdb299178c829 | dfbca0ad4a8def85243851e257c1af6c801707f0 | derickcode/dtm | /dtmsvr/dtmsvr_test.go | Go | go | 13,900 | permissive | package dtmsvr
import (
"database/sql"
"fmt"
"strings"
"testing"
"time"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/yedf/dtm/common"
"github.com/yedf/dtm/dtmcli"
"github.com/yedf/dtm/examples"
)
var DtmServer = examples.DtmServer
var Busi = exam... |
ef71cf41c8b9311acdc773422ceaca7ef7c83743 | 82611f741e2425e26793b2cdc1983d33e1f19f7b | CosmEVM/netcloth-chain | /tests/sim/utils.go | Go | go | 6,719 | permissive | package sim
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strings"
"testing"
"github.com/netcloth/netcloth-chain/codec"
"github.com/netcloth/netcloth-chain/modules/auth"
"github.com/netcloth/netcloth-chain/modules/bank"
"github.com/netcloth/netcloth-chain/modules/cipal"
"github.com/netcloth/netcloth-cha... |
953ef49370d57b9eb7fd56208bf6c9ff3e7b580f | f32da9a3317c5f141ba697ceb4a0b93dc140adc7 | andreev1024/campaign | /main.go | Go | go | 8,608 | no_license | /*
ROUTES
generate data
http GET http://localhost:3000/campaign x==100 y==26 z==10000 -v
import campaign data
http POST http://localhost:3000/import_camp
search
http POST http://localhost:3000/search user=u1 profile:='{"attr_A":"A5","attr_B":"B15", "attr_C":"C15", "attr_D":"D10", "attr_E":"E10"}' -v -j
search... |
8e913815c4c7bf7cb7181c34a847c848e423f540 | 1fae5fd67c5a0e38063973b22538b5f0cdd9448e | jdoshi110/driftctl | /test/acceptance/testing.go | Go | go | 8,177 | permissive | package acceptance
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"strings"
"testing"
"time"
"github.com/cloudskiff/driftctl/pkg/analyser"
cmderrors "github.com/cloudskiff/driftctl/pkg/cmd/errors"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/cloudsk... |
ec500cbd593183bcedbf785c4875a9d2f52b0425 | f3a90a461a56f699773118d0afa842069f80f21c | askarmuratkhan/go-reloaded | /10.rotatevowels/rotatevowels.go | Go | go | 1,142 | no_license | package main
import (
"os"
student ".."
)
func main() {
args := os.Args
if len(args) > 1 {
BigString := ""
for i, val := range args[1:] {
if i+1 == len(args[1:]) {
BigString += val + ""
} else {
BigString += val + " "
}
}
VowelString := ""
for _, value := range BigString {
if value... |
3803cf58f9f959a2fedabcaf24da169c6bc0b1b2 | aece72fe26a9ad1596748e23967a05b272d57144 | pocblockchain/pocc | /x/slashing/abci.go | Go | go | 1,222 | permissive | package slashing
import (
"fmt"
abci "github.com/tendermint/tendermint/abci/types"
tmtypes "github.com/tendermint/tendermint/types"
sdk "github.com/pocblockchain/pocc/types"
)
// slashing begin block functionality
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, sk Keeper) {
// Iterate over all t... |
0917070a6bec5b0b7e950c9f9b6c661f05ec8d70 | 69d40e7367ab891e6740ebf03da87381a4dd2ec1 | vmware/vsphere-automation-sdk-go | /services/nsxt-mp/nsx/fabric/FabricPackageTypes.go | Go | go | 382 | permissive | // Copyright © 2019-2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: BSD-2-Clause
// Auto generated code. DO NOT EDIT.
// Data type definitions file for package: com.vmware.nsx.fabric.
// Includes binding types of a top level structures and enumerations.
// Shared by client-side stubs and server-sid... |
88047072f77e9f0125e97b325a3c8496394d67c5 | b8ffd09e23446a10050bacb73000dd1e02a43db5 | wp-jackliu/opentaobao | /model/gameact/TaobaoDeActivityLuckydrawAPIResponse.go | Go | go | 1,117 | permissive | package gameact
import (
"encoding/xml"
"github.com/bububa/opentaobao/model"
)
// TaobaoDeActivityLuckydrawAPIResponse 抽奖 API返回值
// taobao.de.activity.luckydraw
//
// 用于激励平台对外提供抽奖功能,包括但不限于集分宝、红包、宝点、淘金币、淘彩票等
type TaobaoDeActivityLuckydrawAPIResponse struct {
model.CommonResponse
TaobaoDeActivityLuckydrawAPIRespon... |
19062e6cbe3d7c1583a4f0de11cbc0413e48f841 | 9c579b512269bc9857221f64ca287c0094d8f053 | zhulinhong/origin | /pkg/build/webhook/generic/generic.go | Go | go | 2,367 | permissive | package generic
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strings"
"github.com/golang/glog"
"github.com/openshift/origin/pkg/build/api"
"github.com/openshift/origin/pkg/build/webhook"
)
// WebHookPlugin used for processing manual(or other) webhook requests.
type WebHookPlugin struct{}
// New re... |
213a8b9ca0e002fd65f9f7df035f2ce8ead45d45 | 78998dae9f5fbc2e071dba190f90717bad6f7beb | DirectXMan12/origin | /pkg/build/registry/build/strategy.go | Go | go | 3,428 | permissive | package build
import (
"fmt"
"time"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/generic"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/f... |
c88e9fe212a7ceb9794e0171a695fc69af8ee1c9 | e066c8c9e3fec4757ae2191959db0689d1373325 | gonzalodiaz/astro-cli | /user/user.go | Go | go | 1,037 | permissive | package user
import (
"errors"
"fmt"
"github.com/astronomer/astro-cli/houston"
"github.com/astronomer/astro-cli/pkg/input"
)
// Create verifies input before sending a CreateUser API call to houston
func Create(email string) error {
if len(email) == 0 {
email = input.InputText("Email: ")
}
password, _ := in... |
fdd9acd791e6554f72c1289bfe531d716c34e347 | 6936ecf62b026d4df6d5b9f38a5f15ae4e53851e | martin-belanger/sonic-mgmt-framework | /src/rest/server/handler.go | Go | go | 9,422 | permissive | ////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or //
// its subsidiaries. ... |
cd04f8559d31d18d24523b02a2be041b32f2965a | e37e2963f01055e11fab36aa8a0305fcbbf6a2f4 | dweomer/linuxkit | /src/cmd/linuxkit/cache/push.go | Go | go | 4,318 | permissive | package cache
import (
"fmt"
"github.com/google/go-containerregistry/pkg/authn"
namepkg "github.com/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/google/go-containerregistry/pkg/v1/validate"
"github.com/linuxkit/linuxkit/src/cmd/linuxkit/registry"
imag... |
7fcf462a2dc2478f880513ae8dd0940f4a19d051 | 200cf5bb0747c9bc892cbddf8abe712a5e7ce6aa | edgarlanting/cli | /internal/cmd/token/list.go | Go | go | 1,159 | permissive | package token
import (
"context"
"fmt"
"github.com/planetscale/cli/internal/cmdutil"
"github.com/planetscale/cli/internal/printer"
"github.com/planetscale/planetscale-go/planetscale"
"github.com/spf13/cobra"
)
func ListCmd(ch *cmdutil.Helper) *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Short: "... |
48d24faa16433a7ed23922bec711114b122bdfb1 | a31002c49b6e523047520afb264d8a7e113ec988 | m-nny/tenten | /agents/lazy.go | Go | go | 628 | no_license | package agents
import "github.com/m-nny/tenten/game"
// LazyAgent ...
type LazyAgent struct {
}
// Think Agent's thinking mechanism
func (agent *LazyAgent) Think(state game.State) (action game.Action) {
var chosen uint8
for chosen = 0; chosen < game.ShapesNum; chosen++ {
if !state.AvailableShapes[chosen].IsEmpty... |
cf635261bfd10da08d2e696cbfe22bf5d33eb8e6 | fb82e13688a70e558c50f5fcac924eba9f6d4023 | mshogin/randomtrader | /pkg/exchange/order_test.go | Go | go | 1,210 | permissive | package exchange
import (
"testing"
"time"
"github.com/mshogin/randomtrader/pkg/bidcontext"
"github.com/mshogin/randomtrader/pkg/config"
"github.com/mshogin/randomtrader/pkg/utils"
"github.com/stretchr/testify/assert"
)
func TestExecuteContext(t *testing.T) {
s := assert.New(t)
SetupTestGRPCClient()
for _,... |
7375d1e8aaaac21cfeb876ed23fcf4b5494c601b | 4b1d899fc6093493116f887f74265127bc304855 | saada/eksctl | /pkg/eks/nodegroup_service.go | Go | go | 1,632 | permissive | package eks
import (
"github.com/weaveworks/eksctl/pkg/ami"
api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5"
"github.com/weaveworks/eksctl/pkg/ssh"
"github.com/weaveworks/logger"
)
// A NodeGroupService provides helpers for nodegroup creation
type NodeGroupService struct {
cluster *api.ClusterConf... |
d7ca2fbc0ed414936757544d0498ff9d1309840d | 97f5a9215a656696bbfd1804c8d9afc2bcd4c5d2 | undefcat/judge-euler | /problem1-50/problem40/main.go | Go | go | 976 | no_license | package main
import (
"fmt"
"time"
)
var (
dn = make([]int, 1)
exp10 = make([]int, 10)
)
func getDigit(n int) int {
for i := 1; i < len(dn); i++ {
// n은 i자릿수의 수이다.
if (dn[i-1] < n) && (n <= dn[i]) {
// n자릿수에서 몇번째 digit인지 (zero-based)
idx := n-dn[i-1]-1
// 수 n은 어떤 숫자에 포함되어 있는지
// n자리의 0번째 수부터 구하... |
af28df73343423d0b4040fc2bbb55818d01a4bf3 | 988674bf4981fd7bae0d008ed5475c6f9149eccb | Louhwz/Dragonfly2 | /scheduler/manager/cdn_manager.go | Go | go | 9,540 | permissive | /*
* Copyright 2020 The Dragonfly 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 la... |
7429e417f0fbb0f4c0c789f63d12269d40844b11 | c7d70f0938bfe5b22ce84b631a8f4f94ecd9acb1 | caict-benchmark/BDC-TS | /bulk_query_gen/timescaledb/timescale_iot_singlehost.go | Go | go | 772 | permissive | package timescaledb
import "time"
import bulkQuerygen "github.com/caict-benchmark/BDC-TS/bulk_query_gen"
// TimescaleIotSingleHost produces Timescale-specific queries for the devops single-host case.
type TimescaleIotSingleHost struct {
TimescaleIot
}
func NewTimescaleIotSingleHost(dbConfig bulkQuerygen.DatabaseCon... |
399ee31d3a4313edf455ff7c1789b63eb869979e | 72b17e536c7d42f8104c79ca7bb08875cdee9714 | jamesclonk-io/moviedb-frontend | /Godeps/_workspace/src/github.com/jamesclonk-io/moviedb-backend/modules/moviedb/types.go | Go | go | 6,375 | no_license | package moviedb
import (
"database/sql"
"fmt"
"net/http"
"time"
)
type Statistics struct {
GroundZero time.Time `json:"ground_zero" xml:"ground_zero"`
LastUpdate time.Time `json:"last_update" xml:"last_update"`
Count int `json:"count" xml:"... |
4db8c863d6086b4283b8c0f485bfa2249a37eff9 | 6a19af65389d7f946b0227a4960917a0fa7cc2c7 | chsjiang/postgres-operator | /util/policy.go | Go | go | 3,426 | permissive | package util
/*
Copyright 2017 Crunchy Data Solutions, 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 ... |
e35a9c58e0a6ead5c9e7585b2c50c3e2d0b3f014 | 6e2094525a8d61f3b3150c09a7a542099b1b7fb8 | minizilla/telegram | /options.go | Go | go | 827 | permissive | package telegram
import "net/http"
// TelegramURL is a Telegram Host URL.
const TelegramURL = "https://api.telegram.org"
// The Option is used for tweaking the bot settings.
type Option func(*Bot)
// SetHostURL returns an option to set bot host URL.
func SetHostURL(hostURL string) Option {
return func(bot *Bot) {
... |
64e39826c8d16f40b52693c399d20ac1e02d234a | 54ebca7ecf3ce5b126bd6c753eea8d83c70fb4ba | pedropalau/grumble | /server/channel.go | Go | go | 3,228 | no_license | // Copyright (c) 2010 The Grumble Authors
// The use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE-file.
package server
import (
"encoding/hex"
"github.com/digitalautonomy/grumble/pkg/acl"
)
// A Mumble channel
type Channel struct {
Id int
Name string
Pos... |
5d5626f724a98dc6ae957cb84f48adddb02a5a57 | 51cc9a7f4824b69b85b35e3feb98ae97c1b3e55a | shaozhenyu/gocoding | /leetcode/maxUncrossedLines.go | Go | go | 1,853 | no_license | package main
import "fmt"
func main() {
A := []int{2,5,1,2,5}
B := []int{10,5,2,1,5,2}
A = []int{1}
B = []int{1, 3}
A = []int{1,1,3,5,3,3,5,5,1,1}
B = []int{2,3,2,1,3,5,3,2,2,1}
fmt.Println(maxUncrossedLines(A, B))
}
type Node struct {
x, y int
count int
}
func maxUncrossedLines(A []int, B []int) int {
co... |
5ba943cda472adcbecabc53c3330a93eb0fbac43 | 05920e88bd934292b190d7da38c2ab55d7d74277 | vaginessa/fn | /api/server/runner_async_test.go | Go | go | 3,830 | permissive | package server
import (
"bytes"
"context"
"net/http"
"testing"
"github.com/fnproject/fn/api/agent"
"github.com/fnproject/fn/api/datastore"
"github.com/fnproject/fn/api/models"
"github.com/fnproject/fn/api/mqs"
"github.com/gin-gonic/gin"
)
func testRouterAsync(ds models.Datastore, mq models.MessageQueue, rnr... |
d0e8e5ef785c2d0f53f993545a042212a0246866 | b8fcc595a87ae728e3209b45ddd3e7ce223ee847 | luoyangustc/argus | /argus/dbstorage/proto/log.go | Go | go | 525 | no_license | package proto
import (
"fmt"
)
type ErrorCode int
type Log struct {
TaskId TaskId `bson:"task_id"`
Uid uint32 `bson:"uid"`
Process []int `bson:"process"`
Hash []string `bson:"hash"`
Err []ErrorLog `bson:"error"`
ErrCount int `bson:"error_count"`
}
type ErrorLog struct {... |
918b8370bfd5d82b80f494e8739fb4e7a8795a0d | c43849659d94139e0855b66f19b240fc0a714975 | ahmedmoud/observer_pattern | /observer/provider.go | Go | go | 434 | no_license | package observer
import (
"observer_pattern/Enums"
)
type fn func() ISubject
var eventListener = map[string]fn{
Enums.EXAMPLE_OBSERVER_KEY: func() ISubject {
subjectExample := NewSubjectExample("new instance")
observerExample := NewObserverExample()
subjectExample.RegisterObserver(observerExample)
return ... |
8d02170fb90af388b83d269563ce5adc6ea6dbe3 | 2776488fc2e5f7d8f31aa7cbba5e339fb1645102 | rhoegg/go-learning-examples | /examples/rest/tetris/tetris_test.go | Go | go | 651 | no_license | package main
import (
"github.com/smartystreets/assertions/should"
"github.com/smartystreets/gunit"
"testing"
)
func TestTetrisFixture(t *testing.T) {
gunit.Run(new(TetrisFixture), t)
}
type TetrisFixture struct {
*gunit.Fixture
}
func (this *TetrisFixture) TestDetectLeftmostLowestPoint() {
firstBlockedSpace ... |
801872653cc2e501c1c2234e8ac8562f71896632 | e7ea63694f67ccb71d0fa755f0e2dca0e0497c6d | andyzhangx/kubernetes | /plugin/pkg/scheduler/core/generic_scheduler.go | Go | go | 28,284 | permissive | /*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
ee44dce5d3c9cacda2343756c08f8800dfef8d5c | aa005db57f36b29c0ffe0bc28ee53abc80268a9d | bozzcq/teleport | /session.go | Go | go | 16,411 | permissive | // Copyright 2015-2017 HenryLee. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... |
2c8459fc764d8f91ab26a144edc534c9a9208e83 | 22456a93ee52a891e3d1c98161af3bd0e355d7cd | ManuelB/postgres | /test/e2e/postgres_test.go | Go | go | 74,879 | permissive | package e2e_test
import (
"fmt"
"os"
"strings"
"github.com/appscode/go/log"
"github.com/appscode/go/types"
api "github.com/kubedb/apimachinery/apis/kubedb/v1alpha1"
"github.com/kubedb/apimachinery/client/clientset/versioned/typed/kubedb/v1alpha1/util"
"github.com/kubedb/postgres/test/e2e/framework"
"github.c... |
ac8ee6ecbbd279b3c641f615b8e7ff7dab5e1abc | 626da6ace387019e89081e100e9d7a26d3ce1b42 | outprog/bitfinex-api-go | /tests/integration/v2/mock_ws_private_test.go | Go | go | 24,859 | permissive | package tests
import (
"context"
"fmt"
"testing"
"github.com/outprog/bitfinex-api-go/v2"
"github.com/outprog/bitfinex-api-go/v2/websocket"
)
func TestAuthentication(t *testing.T) {
// create transport & nonce mocks
async := newTestAsync()
nonce := &IncrementingNonceGenerator{}
// create client
ws := webso... |
42785fa3c7123eb2216eb47e60af888a3b96bae0 | 531051029eb9442cb0c6a7675f5e6ed98407870a | vipinvkmenon/cli | /integration/shared/global/unshare_service_command_test.go | Go | go | 16,749 | permissive | package global
import (
"code.cloudfoundry.org/cli/api/cloudcontroller/ccversion"
"code.cloudfoundry.org/cli/integration/helpers"
"code.cloudfoundry.org/cli/integration/helpers/fakeservicebroker"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/ge... |
05da700048a5271dcb89169143e891315287228a | 4c226dc0f4f052c3c61a439fb03d11b06af01be6 | joaoluizn/RPC-Go | /RPC-Go-simple/layers/infrastructure/naming/naming_server.go | Go | go | 1,681 | no_license | package naming
import (
"log"
"net"
"net/http"
"github.com/joaoluizn/RPC-Go/RPC-Go-simple/network"
)
// NewNamingServiceServer builds a new instance of NamingServiceServer
func NewNamingServiceServer(namingServerAddr string) *NamingServiceServer {
return &NamingServiceServer{
requestHandler: NewNamingServic... |
868bb1f2496d2f2a0f7554f959c1d44669df9461 | a331de4733d38e767413e1f61171f995a6dd592f | kanozec/gitea | /main.go | Go | go | 1,685 | permissive | // Copyright 2014 The Gogs Authors. All rights reserved.
// Copyright 2016 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// Gitea (git with a cup of tea) is a painless self-hosted Git Service.
package main // import "code... |
9cf7bbfdc2c6c94182eb1c7e3e4b1c0de56f972d | f93e9bd8f6163123d8274214c52db1bce7b5bb22 | julianchr/magma | /symphony/pkg/authz/policies.go | Go | go | 10,888 | permissive | // Copyright (c) 2004-present Facebook All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package authz
import (
"context"
"fmt"
"github.com/facebookincubator/symphony/graph/graphql/models"
"github.com/facebookincubator/symphony/pkg/ent"
... |
6707f60a7fbd9dff686917cd6d67cfa6c5369971 | 8f3bc573b7b7201090603c368b38436fe45bd52b | couchbaselabs/otto | /builtin_array.go | Go | go | 18,980 | permissive | package otto
import (
"strconv"
"strings"
)
// Array
func builtinArray(call FunctionCall) Value {
return toValue_object(builtinNewArrayNative(call.runtime, call.ArgumentList))
}
func builtinNewArray(self *_object, _ Value, argumentList []Value) Value {
return toValue_object(builtinNewArrayNative(self.runtime, a... |
2b7be869b720ac124cab9376d7aa6637377d900d | c50d8795bb8f2cc56a49fe2e1de55fa09a65c3e1 | Deseao/adventofcode | /internal/day8/instruction.go | Go | go | 3,146 | no_license | package day8
import (
"log"
"strings"
"strconv"
)
type Instructions struct {
List []*Instruction
Accumulator int
Traverser int
}
//Traverse returns the value of accumulator right before executing an already visited instruction.
func (i Instructions) Traverse() int {
if i.List[i.Traverser].Visited == tr... |
6a2449898b14baeb47c7bb7cb89691f9efd8b954 | d7c52132bd70a6f2ea103056f4a962b5ff1c738c | forging2012/sofa-mosn | /pkg/types/network.go | Go | go | 15,482 | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
b3706350530faa92cb2722dcb72412a6e8bd944e | 762e341ef31e19551544fdca2ed96fe2abb7bcb4 | wesports/wechain | /client/simpleclient/simpleclient.go | Go | go | 2,433 | permissive | package main // import "gamecenter.mobi/paicode/client/simpleclient"
import (
"os"
"fmt"
"bufio"
_ "strings"
arghelper "github.com/mattn/go-shellwords"
clicore "gamecenter.mobi/paicode/client"
"github.com/spf13/cobra"
"github.com/hyperledger/fabric/peerex"
)
var mainCmd = &cobra.Command{
Use: ">",
}
var... |
3deaa9f443806025ad133a668fe03af345498010 | ce04c6e9b6556899cc587e643a99ed979cbade7b | jonathansm1th/gopherciser-1 | /scenario/createbookmark.go | Go | go | 3,258 | permissive | package scenario
import (
"context"
"time"
"github.com/pkg/errors"
"github.com/qlik-oss/gopherciser/action"
"github.com/qlik-oss/gopherciser/connection"
"github.com/qlik-oss/gopherciser/creation"
"github.com/qlik-oss/gopherciser/enigmahandlers"
"github.com/qlik-oss/gopherciser/session"
)
type (
//CreateBook... |
6d199cfdf7cbc90e6aaa25862dfa0491d3fd3f2a | 06007bbeef7b714b47e2b06e97054663544be9ab | dejandundjerski/gosdm630 | /internal/meters/sbc.go | Go | go | 3,418 | permissive | package meters
const (
METERTYPE_SBC = "SBC"
/***
* Opcodes for Saia Burgess ALE3
* http://datenblatt.stark-elektronik.de/saia_burgess/DE_DS_Energymeter-ALE3-with-Modbus.pdf
*/
OpCodeSaiaTotalImport = 28 - 1 // double, scaler 100
OpCodeSaiaPartialImport = 30 - 1 // double, scaler 100
OpCodeSaiaTotalExpor... |
fd9f486f5ae7c849e9bb82d923df72274bb28347 | 03c7abab09aa74843a3b81273d3866694586d929 | SaltGan/CookieScanner | /vendor/github.com/CovenantSQL/CovenantSQL/cmd/cql/internal/adapter.go | Go | go | 2,481 | permissive | /*
* Copyright 2018-2019 The CovenantSQL Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable... |
a01a4ac41b8ae6113d9d75d22a28743610a0f1b5 | ceba6760fcbe5d4c582caccd565f705565997c3c | grokify/google-api-go-client | /domainsrdap/v1/domainsrdap-gen.go | Go | go | 55,130 | permissive | // Copyright 2019 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package domainsrdap provides access to the Domains RDAP API.
//
// For product documentation, see: https://developers.google.com/domains/rdap/
/... |
0c56883bf2ffe227abdf13e58ac42659a38053f1 | cb2cc818897aa474df00d258f182387923a9e81f | boshuzhang/goweb | /src/cmd/vet/unsafeptr.go | Go | go | 2,785 | permissive | // Copyright 2014 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.
// Check for invalid uintptr -> unsafe.Pointer conversions.
package main
import (
"go/ast"
"go/token"
"go/types"
)
func init() {
register("unsafeptr",
... |
31adbd2ecc78ed1ee0a0f0fb2f4eff5d61c0c9f8 | c168533a3940ee711677ca8e2985565d4b7b40f5 | Be-Secure/syft | /syft/file/metadata_cataloger_test.go | Go | go | 2,824 | permissive | package file
import (
"flag"
"os"
"testing"
"github.com/anchore/stereoscope/pkg/file"
"github.com/anchore/stereoscope/pkg/imagetest"
"github.com/anchore/syft/syft/source"
"github.com/stretchr/testify/assert"
)
var updateImageGoldenFiles = flag.Bool("update-image", false, "update the golden fixture images used... |
010b5c5814b91a08e6c0e2e26acd1a18705461b6 | eea7fc241176e13970456efde16b2add71113044 | chenglong6622/stock | /leetcode/src/topic149/main.go | Go | go | 2,750 | no_license | package main
import (
"fmt"
"sort"
)
type (
//Point include x, y
Point struct {
X, Y int
}
pointsSorter struct {
data []Point
}
)
func (p *pointsSorter) Len() int { return len(p.data) }
func (p *pointsSorter) Swap(i, j int) { p.data[i], p.data[j] = p.data[j], p.data[i] }
func (p *pointsSorter) Less(i... |
d8414ccaea15c2c2b971f4a4cdb923e64f186455 | b175f2c48d9b065c6587b7e4cb11af6fe8bbc5e5 | tsullens/rook | /pkg/operator/ceph/agent/agent.go | Go | go | 6,549 | permissive | /*
Copyright 2017 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to ... |
779b26d7a85eb00154c8b594de3ab9a831d432b4 | 3d95b6e0a180fd37bcb03bda1084124c07a8867c | j2008/websocket | /example_test.go | Go | go | 1,307 | permissive | // Copyright 2015 The Gorilla WebSocket 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 websocket_test
import (
"log"
"net/http"
"testing"
"github.com/j2008/websocket"
)
var (
c *websocket.Conn
req *http.Request
)
... |
41570a3f591d68e8e0487541a4f24216e0bc9a8a | 7e81f3c905e4983e632eaffb81e32886d9c7f0a8 | yunionio/sdnagent | /vendor/yunion.io/x/onecloud/pkg/cloudcommon/db/quotas/usageworker.go | Go | go | 5,049 | 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... |
c592520bd31b070a5b8ba702a62cac8ba59cfd76 | 634beec580f031fd4528f9361286bebb5b1c938b | jonahjon/eks-product-matrix | /backend/util.go | Go | go | 406 | permissive | package main
import (
"errors"
"os"
"strings"
)
// isRequired
func isRequired(list map[string]string) error {
var err error = nil
for k, v := range list {
if len(v) == 0 {
err = errors.New(strings.Title(k) + " required.")
return err
}
}
return err
}
func getEnv(key, defaultValue string) string {
v... |
ce2a6d5138963d51286bfdf5fc6c46bdf88eeab0 | ee0932921da73c64727df72d529edc36cb9fdd94 | bailangning/edgex-go-1 | /internal/support/scheduler/v2/controller/http/interval_test.go | Go | go | 18,790 | permissive | //
// Copyright (C) 2021 IOTech Ltd
//
// SPDX-License-Identifier: Apache-2.0
package http
import (
"encoding/json"
"fmt"
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/edgexfoundry/edgex-go/internal/support/scheduler/config"
schedulerContainer "github.com/edgexfoundry/edgex-go/internal/suppo... |
6884ffcacd8ba8eecc32cc667f6bad4eaa07bd01 | d1672d9de1474e232ed7c14bcf3ff3049698afc9 | skflorin/aries-framework-go | /test/bdd/bddtests_test.go | Go | go | 5,739 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package bdd
import (
"flag"
"fmt"
"os"
"strconv"
"strings"
"testing"
"time"
"github.com/cucumber/godog"
"github.com/hyperledger/aries-framework-go/pkg/common/log"
"github.com/hyperledger/aries-framework-g... |
730eb4b005ef46fe9af71387cfa01f51974533ef | 704f010fb48199fd7108ee8522d9a382d1593a2b | mgleung/operator | /pkg/common/components.go | Go | go | 1,204 | permissive | // Copyright (c) 2022 Tigera, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
f8918911e079009934ae298fe30613cdd212d63f | b2834bd6f86ec3eb2077785bdca8245a5df809d1 | orange-cloudfoundry/cf-redis-broker | /system/fake_process.go | Go | go | 215 | permissive | package system
type FakeOSProcessInfo struct {
NameReturns string
NameErr error
}
func (processInfo *FakeOSProcessInfo) Name(pid int) (string, error) {
return processInfo.NameReturns, processInfo.NameErr
}
|
c858ea8d7c1e10e3e3be41098fdc72670856f87d | 173c6077144912273383069401996747fef7810f | portainer/libcompose | /docker/network/network_test.go | Go | go | 12,705 | permissive | package network
import (
"fmt"
"testing"
"golang.org/x/net/context"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/client"
"github.com/pkg/errors"
"github.com/portainer/libcompose/config"
"github.com/portainer/libcompose/yaml"
)
type networkNotFo... |
53a0044fdabb0566451b54580db82fe1d69d5612 | 1a33853322d273dc8e681e826ea14713d31fce88 | warriorg/wg | /cache/cache.go | Go | go | 356 | permissive | package cache
// Cache this is a interface which defines some common functions
type Cache interface {
Set(key string, value interface{})
Get(key string) (interface{}, bool)
Delete(key string)
Status() *CacheStatus
}
// CacheStatus c status of chache
type CacheStatus struct {
Gets int64
Hits int64
... |
5ac1f75a08361002a16c4ea953ff767206e641df | d42f3373e59ccb6b432cd9a10e541155b5fd1313 | cristiamu/istio | /security/cmd/istio_ca/main.go | Go | go | 18,984 | permissive | // Copyright 2017 Istio 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 i... |
fcecc8bd050253012786b531bb10b92982a1d9c7 | f26016ee7645ad9d6125fcfb63688fb23ea30790 | scottcagno/cbgb | /item.go | Go | go | 3,502 | permissive | package main
import (
"bytes"
"encoding/binary"
"fmt"
"time"
)
type item struct {
key []byte
exp, flag uint32
cas uint64
data []byte
}
func (i item) String() string {
return fmt.Sprintf("{item key=%s}", i.key)
}
func (i *item) clone() *item {
return &item{
key: i.key,
exp: i.exp,
... |
a9f45d63e0d9953f0d9d9ec8054dd568b1ac0e69 | dd89b061992544b2da4060cc78bff58d7086817e | darashi/goroonga | /goroonga.go | Go | go | 2,739 | no_license | package goroonga
/*
#cgo pkg-config: groonga
#include <groonga.h>
#include <stdlib.h>
*/
import "C"
import "unsafe"
import "fmt"
type Context struct {
ctx *C.grn_ctx
}
type Database struct {
obj *C.grn_obj
}
func Init() error {
if rc := C.grn_init(); rc != C.GRN_SUCCESS {
return fmt.Errorf("grn_init() failed (... |
79b7a5b3724b3452d4f5cacdb223c09a946a860f | ce50b0053ae7ea03cefcd33e3b62244245705fdf | gngeorgiev/goExecutor | /languages/languages.go | Go | go | 460 | no_license | package languages
import (
"fmt"
"github.com/gngeorgiev/goExecutor/languages/baseLanguage"
"github.com/gngeorgiev/goExecutor/languages/javascript"
"github.com/go-errors/errors"
)
const (
LanguageNameJavascript = "js"
)
func GetLanguage(language string) (baseLanguage.Language, error) {
if language == LanguageN... |
7d2cc41f3051461673049a544c6533996218d4a1 | abd76b3bee30f2b20cb0fcd4834b6fed93dc7a26 | eduardoflorendo/sourcegraph | /cmd/frontend/internal/pkg/discussions/format.go | Go | go | 3,743 | permissive | package discussions
import (
"bytes"
"context"
"fmt"
"html/template"
"regexp"
"strconv"
"strings"
"github.com/sourcegraph/sourcegraph/cmd/frontend/types"
"github.com/sourcegraph/sourcegraph/pkg/highlight"
)
func formatTargetRepoLinesText(tr *types.DiscussionThreadTargetRepo) string {
if !tr.HasSelection() ... |
34f7bdb789093d35904d2a8d3617830a2a201a64 | 0aced02c3041e4c27570bf24b6435293dc3f9825 | cloudfoundry/bosh-bootloader | /vendor/go.opencensus.io/stats/record.go | Go | go | 1,857 | 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... |
c1a5a4f9a05f6d81d78dc181779e4403a1b10cf7 | 2813314e2ae77352fa663ca3cf6a8fa49920fb75 | Chillimeat/dmesh-l2 | /pkg/l2/wpa_dnssd.go | Go | go | 7,158 | permissive | package l2
import (
"bytes"
"encoding/binary"
"encoding/hex"
"errors"
"log"
"strconv"
"strings"
mesh "github.com/costinm/dmesh-l2/pkg/l2api"
//"github.com/costinm/dmesh/dm/mesh"
)
// Minimal DNS-SD support, used to parse WPA "P2P-SERV-DISC-RESP" for older Android versions.
// From Android Q, the P2P uses a ... |
84de8eb5ff706315f2586762428f087a1d02e6d0 | 7b7f0a64c36b1d71f9c0ed0e8a5ce7d785ed67a3 | r2d2-ai/aiflow | /trigger/common/loadtester/trigger.go | Go | go | 1,988 | permissive | package loadtester
import (
"fmt"
"time"
"github.com/r2d2-ai/aiflow/data/metadata"
"github.com/r2d2-ai/aiflow/support/log"
"github.com/r2d2-ai/aiflow/trigger"
)
var triggerMd = trigger.NewMetadata(&Settings{}, &Output{})
func init() {
trigger.Register(&Trigger{}, &Factory{})
}
type Factory struct {
}
// Met... |
7acc66ef81a727f11ee57f4f87c80f76a768a701 | 4bd57023238fdb0dc8d5d1eb04a9263cd500ff7a | EmoinLanyu/gardener | /pkg/operation/botanist/dnsresources.go | Go | go | 5,832 | permissive | // Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Lice... |
48e72659f1263bfbd0a54526616af511f218b9d6 | 11f91cea24112933111621c9fbd9d6a34466fa97 | yftacherzog/assisted-service | /internal/host/refresh_status_preprocessor.go | Go | go | 3,193 | permissive | package host
import (
"github.com/openshift/assisted-service/internal/hardware"
"github.com/sirupsen/logrus"
)
type validationResult struct {
ID validationID `json:"id"`
Status validationStatus `json:"status"`
Message string `json:"message"`
}
type refreshPreprocessor struct {
log l... |
af6c27320ca363c9492f773a5bdf505d8974a3c8 | f6215474d48cab63d0d22cc3189df8ccfb571175 | openshift/service-idler | /vendor/k8s.io/client-go/listers/core/v1/endpoints.go | Go | go | 3,132 | permissive | /*
Copyright 2018 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, ... |
35f4cc9a594ee40bb0547eb4223ed51bbe0ac971 | 18e38b68ced85de6cd65a559a5807387054767e7 | 550135928/proxy-pool | /cmd/scheduler/main.go | Go | go | 530 | permissive | package main
import (
"proxy-pool/check"
"proxy-pool/config"
"proxy-pool/databases"
"proxy-pool/fetch"
"github.com/jasonlvhit/gocron"
)
func main() {
config := config.New()
db := databases.New(config.Mysql)
checker := check.NewChecker(db, config)
gocron.Every(config.CheckProxy.CheckAllInterval).Seconds().Do... |
fc95788bfe5e13388f0675ed1255d05037ff5d21 | 86854caf1e662cc631bdee6929208a5d08451a0a | remotejob/remotejob.github.io | /src/github.com/remotejob/apartment_ru_go/godevice/godevice.go | Go | go | 1,614 | no_license | package godevice
import (
"net/http"
"strings"
)
func GetType(r *http.Request) string {
userAgent := r.Header.Get("User-Agent")
deviceType := "Web"
if strings.Contains(userAgent, "Android") ||
strings.Contains(userAgent, "webOS") ||
strings.Contains(userAgent, "iPhone") ||
strings.Contains(userAgent, "Bla... |
5ce974e781a57a5ee7def45dfba52c885d222a54 | 912fec21a305520f3746a5f5bfa346215526782d | a20351766/mchain1.2 | /core/chaincode/upgrade_test.go | Go | go | 9,739 | permissive | /*
Copyright IBM Corp. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
2f274d1843e1376239728e03b556062021c1a6c5 | fa9d8ea585a7637b088526f0122dd1231c71a75d | fscala/woke | /pkg/util/contenttype.go | Go | go | 1,008 | permissive | package util
import (
"errors"
"net/http"
"os"
"strings"
)
var ErrFileEmpty = errors.New("file is empty")
var ErrFileNotText = errors.New("file is not a text file")
func detectContentType(file *os.File) string {
// Only the first 512 bytes are used to sniff the content type.
buffer := make([]byte, 512)
n, _ :... |
4cb60d73033e7e2d590ae0bc9a7e79eb3f4b44a8 | c649913d873e0c16df16852bc8530aafcd18daa3 | microsoftgraph/msgraph-sdk-go | /models/access_package_request_type.go | Go | go | 2,370 | permissive | package models
import (
"errors"
)
//
type AccessPackageRequestType int
const (
NOTSPECIFIED_ACCESSPACKAGEREQUESTTYPE AccessPackageRequestType = iota
USERADD_ACCESSPACKAGEREQUESTTYPE
USERUPDATE_ACCESSPACKAGEREQUESTTYPE
USERREMOVE_ACCESSPACKAGEREQUESTTYPE
ADMINADD_ACCESSPACKAGEREQUESTTYPE
A... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.