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 |
|---|---|---|---|---|---|---|---|---|
714dbe0385745e3b9cc8e0fcf9ee90f5e0ee730c | d4a1f2863e23f45dcb7e6226e79fd82cb42abd12 | veselink1/quick-draw | /pkg/pagination/pages_test.go | Go | go | 3,953 | permissive | package pagination
import (
"bytes"
"net/http"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNew(t *testing.T) {
tests := []struct {
tag string
page, perPage, total ... |
688aa4054a307e8e57add725e4f6979e277c7be6 | d96e50f625fedd846b4a6a8eac1ce2d53a44a818 | viannaandreBR/cli | /actor/pushaction/command_line_settings_windows_test.go | Go | go | 2,249 | permissive | // +build windows
package pushaction_test
import (
. "code.cloudfoundry.org/cli/actor/pushaction"
"code.cloudfoundry.org/cli/util/manifest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("CommandLineSettings with provided path", func() {
co... |
a124b58221756267e722c4ca6bbff15d07cade49 | 66342b7418d541d492028829199c2b13ea5edc6d | istio-ecosystem/istio-coredns-plugin | /vendor/cloud.google.com/go/securitycenter/apiv1beta1/mock_test.go | Go | go | 46,442 | permissive | // Copyright 2018 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
e12fbc32075dbd8db51963b0b03facbcf0b732db | 53d8a9fc3e12d0ceff7c4c275a28b65faa55cc65 | bfloriang/dock2box | /cli/command/query_interface_command.go | Go | go | 949 | permissive | package command
import (
"encoding/json"
"fmt"
"log"
"strings"
"github.com/codegangsta/cli"
"github.com/imc-trading/dock2box/client"
)
func NewQueryInterfaceCommand() cli.Command {
return cli.Command{
Name: "interface",
Usage: "Query interfaces",
Flags: []cli.Flag{},
Action: func(c *cli.Context) {
... |
9c52773c0330d106a9d8e220049a8b0c2333cd59 | a9b0d8c3fdf7ea8c64e3df889b2194493015d046 | mehulsbhatt/badwolf | /bql/lexer/lexer.go | Go | go | 18,760 | permissive | // Copyright 2015 Google 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 applicable... |
2324ef2628cf96d6c3386d97178ade8216727364 | 670d8b0267286c9df592eae1e64887a48d695428 | solidnerd/terraform-provider-libvirt | /libvirt/utils_domain_def.go | Go | go | 2,482 | permissive | package libvirt
import (
"fmt"
libvirtxml "github.com/libvirt/libvirt-go-xml"
"log"
"strings"
)
func getGuestForArchType(caps libvirtxml.Caps, arch string, virttype string) (libvirtxml.CapsGuest, error) {
for _, guest := range caps.Guests {
log.Printf("[TRACE] Checking for %s/%s against %s/%s\n", arch, virttyp... |
6bac4ea97af44bbfb1d267682c781bfda900e820 | 61a8bf3063679f59205bfb3c07c56fcaf857c61b | danielfoehrKn/external-dns-management | /vendor/github.com/gardener/controller-manager-library/pkg/controllermanager/cluster/cluster.go | Go | go | 8,771 | permissive | /*
* Copyright 2019 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 Licen... |
5ac03dc9e5a81e3540800d7fbaa9cc3b66f77473 | 4ac26d2d51a0ae53e149f0455272c7b6a91b642b | fmagellan/go | /slices1.go | Go | go | 223 | no_license | package main
import "fmt"
func main() {
var arr5 [5]int = [5]int{5, 4, 3, 2, 1}
fmt.Println(arr5)
var arr3 [3]int = arr5[0 : 3]
fmt.Println(arr3)
var arr4 []int = arr5[0 : 4]
fmt.Println(arr4)
}
|
50432e4cafece23a1caf1ee6b4f3e0ef182cd193 | 7f4cff0800e7bb6f45793bbce307eb0817186a70 | pengzj/swift | /cron/cron_test.go | Go | go | 1,368 | permissive | package cron
import (
"testing"
"time"
)
func TestStr2Int(t *testing.T) {
one := "123"
oneInt, err := Str2Int(one)
if err != nil {
t.Fatal(err)
} else {
t.Log(oneInt)
}
one = "12F3"
oneInt, err = Str2Int(one)
if err != nil {
t.Log(err)
} else {
t.Fatal(oneInt)
}
one = "123$"
oneInt, err = Str2... |
3c0d02f2d26347bcc9c35215a937ab1c16d2234c | 7b192c8e5bb0f6d28e708be108464ff0d835580e | asyou-me/lib.v1 | /log_client/log.go | Go | go | 951 | no_license | package log_client
import (
"fmt"
"os"
"time"
"github.com/asyou-me/lib.v1/pulic_type"
)
var (
ReconnectInterval = 5
FileTimeFormat = "2006-01-02"
)
/*
测试环境
C P U:i5 6600
内 存:8G DDR4 2144
硬 盘:ssd 400mb/s
使用file后端 6w/s写入速度 内存占用170M cpu 8%
使用redis后端 6w/s写入速度 内存占用170M cpu 28%
*/
var _baseLog *ConsoleHa... |
f7012c44a8e54c60e53405e9803f1bd8cb5d3526 | eaa4f250036be3eef340105128d66232d17a915a | woniu317/leetcode | /uniquePath.go | Go | go | 846 | no_license | package main
import "fmt"
func main() {
//fmt.Println(uniquePaths(7, 3))
fmt.Println(uniquePathsWithObstacles([][]int{{0, 0, 0}, {0, 1, 0}, {0, 0, 0}}))
}
func uniquePaths(m int, n int) int {
x, y := 1, 1
minV := min(m, n)
for i, j := m+n-2, 1; j < minV; i-- {
x *= i
j += 1
}
for i := 2; i < minV; i++ {
... |
4bcfb695aa853e9984e696bddb0f05b862336ffa | 2499f803cd7245503d42149cf4373ea5cac57d80 | haowai31/LeetCodeGO | /24. Swap Nodes in Pairs.go | Go | go | 528 | no_license | package main
func swapPairs(head *ListNode) *ListNode {
var tmp = &ListNode{}
tmp.Next = head
result := tmp
for {
if tmp.Next == nil || tmp.Next.Next == nil {
break
}
next := tmp.Next
tmp.Next = tmp.Next.Next
next.Next = tmp.Next.Next
tmp.Next.Next = next
tmp = tmp.Next
tmp = tmp.Next
}
retur... |
d6276a2b6545dea32aa96fdb14796bb2bfc34a88 | 3c4043f2a4fe912cdf780b69562e78d61d0470d5 | jjggzz/kit | /sd/internal/instance/cache_test.go | Go | go | 3,240 | permissive | package instance
import (
"context"
"fmt"
"io"
"reflect"
"testing"
"time"
"github.com/jjggzz/kit/endpoint"
"github.com/jjggzz/kit/log"
"github.com/jjggzz/kit/sd"
)
var _ sd.Instancer = (*Cache)(nil) // API check
// The test verifies the following:
// registering causes initial notification of the current... |
6b77a592a67c860a8ec1b6abedf98ec7dbaacf17 | 44be4ad0a5cd9c223b5ddaf42dd7e600c43f76da | bowen5/AgentBaker | /pkg/templates/templates_generated.go | Go | go | 189,525 | permissive | // Code generated for package templates by go-bindata DO NOT EDIT. (@generated)
// sources:
// linux/cloud-init/artifacts/apt-preferences
// linux/cloud-init/artifacts/auditd-rules
// linux/cloud-init/artifacts/cis.sh
// linux/cloud-init/artifacts/cse_cmd.sh
// linux/cloud-init/artifacts/cse_config.sh
// linux/cloud-in... |
8284156d29a86d237c73f999e3cf598838604927 | c6ca3ab45d10cbda67c9298cd37ec82363a722c5 | thinkerwolf/GoStudy | /function/function_closure_anony.go | Go | go | 597 | permissive | package function
import (
"fmt"
"strings"
)
// 匿名函数就是闭包
func FuncAnony() {
func(sum int) {
for i := 1; i <= 1e6; i++ {
sum += i
}
fmt.Printf("The FuncAnony result is %d\n", sum)
}(9)
makeJpg := MakeAddSuffix(".jpg")
makeTxt := MakeAddSuffix(".txt")
fmt.Println("MakeJpg " + makeJpg("photo"))
fmt.Pr... |
aa8a47862ee0947d1679e7a3056f96fdff0fae13 | 1beb4ab65c02c1b83a4426a473bea4f59b0e2f20 | ms123s/skydock | /main.go | Go | go | 9,554 | permissive | /*
Multihost
Multiple ports
*/
package main
import (
"encoding/json"
"flag"
"fmt"
"github.com/crosbymichael/log"
"github.com/ms123s/skydock/docker"
"github.com/ms123s/skydock/utils"
influxdb "github.com/influxdb/influxdb-go"
"os"
"sync"
"time"
"strings"
"github.com/ms123s/skydock/client"
"github.co... |
b3d9632197f88918ddc2a00579b2af037f626a93 | 55661e3f7078790bb701432bed052d3d0d662f81 | piyushpatel2005/go-programming | /src/19-functions.go | Go | go | 2,749 | no_license | package main
import "fmt"
func main() {
greeting := greet()
fmt.Println(greeting)
fmt.Println(hello("Jack"))
a, b := 2, 3
fmt.Printf("%d + %d = %d\n", a, b, add(a, b))
quotient, remainder := division(5, 2)
fmt.Println(quotient, remainder)
// Blank identifier - we don't need to declare variable if we are no... |
d9cf677859e1206cd54f65d62bb4e0e89be09191 | ec2898271c882bf20f99bd52c957447ed593a6d3 | Azure/ARO-RP | /vendor/github.com/microsoftgraph/msgraph-sdk-go/rolemanagement/entitlement_management_role_eligibility_schedule_instances_filter_by_current_user_with_on_response.go | Go | go | 5,467 | permissive | package rolemanagement
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242 "github.com/microsoftgraph/msgraph-sdk-go/models"
)
// EntitlementManagementRoleEligibi... |
7a15ce0135c4b71b91742344b52a3b16ed7192d5 | d1678fe3f2d69054e264ac25eecea551a087512d | shreevatsa/url2epub | /rmapi/item.go | Go | go | 1,366 | permissive | package rmapi
import (
"fmt"
)
// ItemInfo defines the json format of an item metadata.
//
// Some of the fields are only used in requests and some of the fields are only
// used in responses, as a result it's important for all of them to have
// omitempty json tag.
type ItemInfo struct {
ID string `json:... |
718fef08e043417a1630f5e79888ef7b78721ba4 | 69f87f50b96f12354c14b18c75291a31567b00ad | joeyjarosz/deployer | /cmd/deployer/deployer_test.go | Go | go | 1,358 | permissive | package main
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCliCreateRelease(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if err := r.ParseForm(); err != nil {
t.Error(err)
return
}
... |
05438ea7e128a2e5fb0852f095b16b09d0db9cf0 | a2fe4daa26f72b3ac01b0f4907c8dd77ac2f70cc | ass-a2s/rancheros | /vendor/github.com/docker/libcompose/config/merge_v2.go | Go | go | 5,091 | permissive | package config
import (
"fmt"
"path"
"github.com/Sirupsen/logrus"
yaml "github.com/cloudfoundry-incubator/candiedyaml"
"github.com/docker/libcompose/utils"
)
// MergeServicesV2 merges a v2 compose file into an existing set of service configs
func MergeServicesV2(existingServices *ServiceConfigs, environmentLook... |
2b324d1d4cd7da9bef44c47f4280a7c7d12903bc | 10ce0416e672b1d124540f64938cbdf0b8c52e68 | luobangkui/gocron | /internal/models/task_log.go | Go | go | 3,460 | permissive | package models
import (
"time"
"github.com/go-xorm/xorm"
)
type TaskType int8
// 任务执行日志
type TaskLog struct {
Id int64 `json:"id" xorm:"bigint pk autoincr"`
TaskId int `json:"task_id" xorm:"int notnull index default 0"` // 任务id
Name string `json:"name" xorm:"varcha... |
976910d22e21fc77fe96bd84a34e5c12afeb41c5 | 34a5f8e9002cb659bb195e93817fc7ee60e24b2c | Donate-Anything/imagemonkey-core | /src/migrations/attach_labels_to_user_collection.go | Go | go | 4,115 | no_license | package main
import (
log "github.com/sirupsen/logrus"
"flag"
"database/sql"
"errors"
"github.com/lib/pq"
)
var db *sql.DB
func doLabelTransition(tx *sql.Tx, labelSuggestion string, imageCollectionName string, imageCollectionDescription string, username string) error {
rows, err := tx.Query(`SELECT i.id, s.id
... |
fe66a20eb6543bb809e72ac3da955cbe8a7a747a | 401ab64ca91abb4af4f01e5d34e29778b05b863d | tsugitta/atcoder | /contests/abc140/abc140_e/main_test.go | Go | go | 3,320 | no_license | package main
import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"log"
"os"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/tsugitta/atcoder/testutil"
)
func naive(io *Io, d *Io) {
N := io.NextInt()
ps := io.NextInts(N)
res := 0
for l := 0; l+1 < len(ps); l++ {
for r := l + 1; r < len(p... |
208aa13800f93883cc9859b3a9746964dcc2cc24 | 79c732350f3acb4ff91588d4470f0ce78054cdc0 | elahe-dastan/code101 | /Go/spiral/main.go | Go | go | 1,684 | no_license | package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
func main() {
reader := bufio.NewReader(os.Stdin)
nCommands,_ := reader.ReadString('\n')
nCommands = strings.TrimSuffix(nCommands, "\n")
q,_ := strconv.Atoi(nCommands)
commands := make([]string, q)
for i := 0; i < q; i++ {
command,_ := reade... |
1abd8c2a4eef3146c4da8fe7f1d94ee60cd832e4 | 89463b6edb73421d4aba5bde292e6885009dedd0 | BrodieRobertson/shox | /pkg/proxy/csi.go | Go | go | 5,012 | permissive | package proxy
import (
"fmt"
"strconv"
"strings"
)
type csiHandler func(params []string, intermediate string) (output []byte, redraw bool, err error)
func (p *Proxy) handleCSI(pty chan byte) (output []byte, original []byte, redraw bool, err error) {
var csiSequences = map[byte]csiHandler{
'd': p.csiLinePositi... |
b3479d9e18af278d2b87408fc5807c59505a5bbf | 58721eb7e809472a8460a3b56ead3fc0d3dfe9cc | 0pendev/kubic-control | /pkg/kubeadm/addNode.go | Go | go | 7,444 | permissive | // Copyright 2019, 2020 Thorsten Kukuk
//
// 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 agre... |
1fa6275e32338d4d1cb5d909cf89533bebc072e0 | 093a7c76389db32a6232bdc786c527cf20087aa8 | xzyaoi/gosql | /db.go | Go | go | 8,173 | permissive | package gosql
import (
"bufio"
"bytes"
"context"
"database/sql"
"log"
"os"
"reflect"
"strings"
"time"
"github.com/jmoiron/sqlx"
)
type ISqlx interface {
Queryx(query string, args ...interface{}) (*sqlx.Rows, error)
QueryRowx(query string, args ...interface{}) *sqlx.Row
Get(dest interface{}, query string... |
2acbac6709f05cd21c0d7c3547ef9edadecab683 | daeaf853491428b76ee98020480b835196b878ee | EoinGohery/Pc-Builder | /pkg/builder/driveBuilder.go | Go | go | 429 | no_license | package builder
type driveBuilder struct {
url []byte
}
//connstructor
func newDriveBuilder() *driveBuilder {
return &driveBuilder{}
}
//send request that triggers the vistor method fort this object type
func (b *driveBuilder) sendRequest(v visitor) {
v.visitForDrive(b)
}
//get teh result of teh send request.
fu... |
66b0d8f3c17f0f5cde69ebfa3f12dcb6636f945a | 32f2803595f57dc73849584f523c955130343f82 | ver007/wiregost | /client/commands/server.go | Go | go | 3,822 | no_license | // Wiregost - Golang Exploitation Framework
// Copyright © 2020 Para
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later versi... |
92c64952b45cdf994a91534e4407e51ad3ff6042 | f91509664906fd0fc354166a464734ab6be3d114 | goglides/firecamp | /containersvc/swarm/swarmservice.go | Go | go | 32,109 | permissive | package swarmsvc
import (
"fmt"
"io"
"sort"
"time"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
mounttypes "github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api... |
4ab825f7f5dafb6509ee11b5cc2e73d62f56711f | 5944dfecfba0f1fb7d0c37d10d2df89459847913 | WHRP/vilicus | /pkg/api/analysis/platform/pgsql/analysis.go | Go | go | 779 | permissive | package pgsql
import (
"time"
"github.com/go-pg/pg/v10/orm"
"github.com/edersonbrilhante/vilicus/pkg/types"
)
// Analysis represents the client for analysis table
type Analysis struct{}
// Create creates a new analysis on database
func (a Analysis) Create(db orm.DB, al types.Analysis) (types.Analysis, error) {
... |
ffce47e3b0af3229eb8b4909cf0e6319b9b9ef7b | 67c736555b8a0310fe3eaffc038e6b5097b76844 | victorfrancax1/cosmos-sdk | /x/ibc/applications/transfer/module.go | Go | go | 14,684 | permissive | package transfer
import (
"context"
"encoding/json"
"fmt"
"math"
"math/rand"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/gorilla/mux"
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
c... |
95e8bd86d67e2f2e52a7306150f09d70b34ae5bc | e0b0dc60a41696307a45985d85f122c7e9008f57 | devit-tel/gogo-blueprint | /config/config_test.go | Go | go | 338 | no_license | package config
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestGet(t *testing.T) {
appConfig := Get()
require.Equal(t, "mongodb://localhost:27017", appConfig.MongoDBEndpoint)
require.Equal(t, "company_test", appConfig.MongoDBCompanyTableName)
require.Equal(t, "staff_test", appConfig.MongoDB... |
a703c9282cad2ce886d802ab10f36a913a893245 | 6d13ce6b34d2a3fc515b9b9f20c546629f3378e6 | yamamoto-febc/sacloud-upload-archive | /vendor/github.com/yamamoto-febc/libsacloud/sacloud/switch.go | Go | go | 2,530 | permissive | package sacloud
import (
"fmt"
"net"
"time"
)
// Switch type of switch
type Switch struct {
*Resource
Name string `json:",omitempty"`
Description string `json:",omitempty"`
ServerCount int `json:",omitempty"`
ApplianceCount int `json:",omitempty"`
Scope EScope `json:",omit... |
a64a546f3e036abf12f071ccf3db41f05e4e68ef | 9e12e02cf406b015eaad3e06ddab037a4903bb15 | continuum-irfan-shaikh/SharedFolder | /vendor/gitlab.connectwisedev.com/platform/platform-api-model/clients/model/Golang/resourceModel/graphql/Schemas/SOCUserRiskScoresSchema/UserLogonSchema.go | Go | go | 4,740 | no_license | package SOCUserRiskScoresSchema
import (
"github.com/graphql-go/graphql"
)
//Events : Event struct
type Events struct {
LogonType string `json:"logonType"`
Success int32 `json:"success"`
Failure int32 `json:"failure"`
}
// EventsType : EventsType GraphQL Schema
var EventsType = graphql.NewObject(graphql.Ob... |
7d1c9d1226aa0a973dbef351e855184eca37631c | 8fa88ce90ce50dd9c61c98ef425e59b96f6ef03a | rlacko58/gjango | /repository/account/account.go | Go | go | 1,473 | permissive | package account
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/gogjango/gjango/apperr"
"github.com/gogjango/gjango/model"
"github.com/gogjango/gjango/secret"
)
// Service represents the account application service
type Service struct {
accountRepo model.AccountRepo
userRepo model.UserRepo
rbac... |
c5bf3fcd0a5564c7c816f8a86d96883d8a756f71 | cab8fd5cad42330c37070cbfe458d825868dd3b5 | avelino/undistro | /third_party/pinniped/internal/controller/apicerts/certs_observer.go | Go | go | 2,594 | permissive | // Copyright 2020-2021 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package apicerts
import (
"fmt"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
corev1informers "k8s.io/client-go/informers/core/v1"
"k8s.io/klog/v2"
pinnipedcontroller "github.com/getupio-undistro/undi... |
5ec4c050ed1106c0e3420f302029874977d48a57 | 707f0bbed443ed22911cf5b1a206357b3fa3b0da | hunshenshi/go-learn | /leetcode/5_longest_palindromic_substring.go | Go | go | 1,016 | no_license | package main
import "fmt"
func main() {
s := "abba"
//fmt.Println(s[1:2+1])
fmt.Println(longestPalindrome(s))
}
func longestPalindrome(s string) string {
if len(s) <= 1 {
return s
}
start, end, max := 0, 0, 0
for i := 0; i < len(s); i++ {
// 这里以i为中心向外扩展,只考虑了奇数的情况,
// 当偶数时,中心点不是一个数,而是以两个数为中心
for j := ... |
69e7c91ac2a29ebab18cf5fc5b86e61af2cdb065 | 55dfade15e9f436bc8074a58bdf2b564f5fe22b7 | sridhar02/ecommerce | /order.go | Go | go | 3,756 | no_license | package main
import (
"database/sql"
"fmt"
"github.com/gin-gonic/gin"
"net/http"
"time"
)
type ProductQuantity struct {
ProductId int `json:"product_id"`
Quantity int `json:"quantity"`
}
func postOrderHandler(c *gin.Context, db *sql.DB) {
userId, err := authorization(c, db)
if err != nil {
return
}
va... |
33e0295b994fb40e63e91bc02ca4eac018a864d8 | 9d21c428bc886ea6f25faf0305a41fef9c90f22b | steven-zou/harbor | /src/core/api/email.go | Go | go | 3,134 | permissive | // Copyright 2018 Project Harbor Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agr... |
b1596644bcaec7fc5d4e839714462aa73870fde5 | 7769ee7378369631126dd9015968de44b5b52f36 | ubwshook/template_data | /arachnid/go/config/config.go | Go | go | 422 | no_license | package config
import (
"errors"
"flag"
"fmt"
)
type CmdConfig struct {
ParasTableId string
}
func (c *CmdConfig) ReadCmdParameter() error {
flag.StringVar(&(c.ParasTableId), "paras", "paras_table", "爬虫参数表名")
flag.Parse()
if flag.NFlag() < 1 {
fmt.Printf("Cmd parameter not enough. now:[%d]\n", flag.NFlag()... |
a24d446d5779c1b184368438be4c32ba241c6e6d | afda2092f01ab796de271658d6f03a5186729da6 | drasted/core | /insonmnia/hardware/mem/device.go | Go | go | 535 | permissive | package mem
type Device interface {
// PhysicalId returns device's physical id on the motherboard.
PhysicalId() int
// DeviceName returns device name for example "DIMM DDR3 1333 MHz (0.8 ns)".
DeviceName() string
// Vendor returns vendor name.
VendorName() string
// MemorySize returns memory size in bytes.
Mem... |
7e9244b8e6eb0a96a70183e394849c868aaafd20 | 5d0499f2b2aa14a029fadf2626269da4b2b10ef4 | chris-wood/odoh-server | /vendor/github.com/elastic/go-elasticsearch/v8/esapi/api.cat.indices.go | Go | go | 8,437 | permissive | // Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// Code generated from specification version 8.0.0: DO NOT EDIT
package esapi
import (
"context"
"net/http... |
a7f1445d67cf8732dca58f2bd443dd712bd320a7 | 57e87fde1de179f4eb74cd4faa0e078ec6a91bab | DavidS/pcore | /px/context_test.go | Go | go | 1,248 | permissive | package px_test
import (
"fmt"
"github.com/lyraproj/pcore/pcore"
"github.com/lyraproj/pcore/px"
)
func ExampleContext_ParseType() {
pcore.Do(func(c px.Context) {
t := c.ParseType(`Object[
name => 'Address',
attributes => {
'annotations' => {
'type' => Optional[Hash[String, String]... |
80edcb0f58827a94c474df4e4a4fa6daaf980551 | 83d042d36c78edf7993707beaba66c5b77b01d58 | codecov/example-go | /calculator.go | Go | go | 356 | permissive | package calculator
import "errors"
func Add(x, y int) (int, error) {
return x + y, nil
}
func Subtract(x, y int) (int, error) {
return x - y, nil
}
func Multiply(x, y int) (int, error) {
return x * y, nil
}
func Divide(x, y int) (float64, error) {
if y == 0 {
return 0, errors.New("Cannot divide by 0")
}
re... |
9c86c870b279fbd34545cd24fd10e1519362dd46 | e98c6b1d7910e58b313ea0cec5db9a1183a694ad | lancosch/winman | /window.go | Go | go | 7,624 | permissive | package winman
import (
"fmt"
"github.com/gdamore/tcell"
"github.com/rivo/tview"
)
// Window interface defines primitives that can be managed by the Window Manager
type Window interface {
tview.Primitive
// IsModal defines this window as modal. When a window is modal, input cannot go to other windows
IsModal()... |
5fda0f44b735400383afc71fea8c5fb3c828477a | 073198a02a1bc4ad70282b5ec28752bc5e928e9a | bpkgoud/pulumi-azure-native | /sdk/go/azure/apimanagement/v20170301/getPolicy.go | Go | go | 755 | permissive |
package v20170301
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func LookupPolicy(ctx *pulumi.Context, args *LookupPolicyArgs, opts ...pulumi.InvokeOption) (*LookupPolicyResult, error) {
var rv LookupPolicyResult
err := ctx.Invoke("azure-native:apimanagement/v20170301:getPolicy", args, &rv, opts...)
i... |
d5b7d1929e73703b51a6e851bb44edaaf23406ec | 0653058f6e1e0a4d704ddef06986d9cf3c2047df | niteshexa/CloudFoundry_CLI | /command/v7/cancel_deployment_command_test.go | Go | go | 6,304 | permissive | package v7_test
import (
"errors"
"code.cloudfoundry.org/cli/actor/actionerror"
"code.cloudfoundry.org/cli/actor/v7action"
"code.cloudfoundry.org/cli/command/commandfakes"
"code.cloudfoundry.org/cli/command/flag"
. "code.cloudfoundry.org/cli/command/v7"
"code.cloudfoundry.org/cli/command/v7/v7fakes"
"code.clo... |
c93172adf1f3b61edcefb9985f55a6966b0e1c59 | 2b2d5d96c15a5e2131bb1f4736d94f102dca75bf | tst547/control | /src/screen/win.go | Go | go | 693 | no_license | package screen
import (
"image"
"github.com/antonlahti/go-winapi"
"syscall"
"unsafe"
)
var(
rect = new(image.Rectangle)
)
func ChooseWin() (*image.Rectangle,error) {
ret,err := rectInfo()
rect.Min.X=int(ret.Left)
rect.Min.Y=int(ret.Top)
rect.Max.X=int(ret.Right-ret.Left)
rect.Max.Y=int(ret.Bottom-ret.Top)
... |
0df330ecbe439d2b4f3850a24f0064dc3b6642ad | 4bab044b8df72ddf01ff722c787391da3117e5a8 | dulumao/MarioDB | /response/response.go | Go | go | 1,651 | no_license | package response
import (
"github.com/Diode222/MarioDB/dbEventPackage/request"
"github.com/Diode222/MarioDB/event/eventInfo"
"github.com/Diode222/MarioDB/response/responseErrors"
"log"
"sync"
)
type responseDataSync struct {
Lock sync.RWMutex
Data []byte
}
func Response(packages []*request.RequestDBEventPacka... |
c4a9a65f9eb2b9af0a03d5102e78d3fe79d3e1cd | 080cf82b6ce03f78c52dd56f801ac0a181051a86 | zakimal/aoj | /aoj/aoj-v1-0198.go | Go | go | 1,778 | no_license | package main
import (
"bufio"
"fmt"
"os"
"reflect"
"strconv"
"strings"
)
var scanner = bufio.NewScanner(os.Stdin)
func main() {
// 上面の色を固定してから、左右方向に回転して一致するものがあるかを調べる
round := [][]int{
{1, 2, 3, 4, 5, 6}, {1, 3, 5, 2, 4, 6}, {1, 4, 2, 5, 3, 6}, {1, 5, 4, 3, 2, 6}, // c1を上面に固定して回転
{2, 6, 3, 4, 1, 5}, {2, ... |
3a201c16911306c9122cc1019bcae9bbc6e330e0 | 0b1645b4053791d645628283ee92b24b4bfbfa89 | mcdee/go-ssz | /spectests/ssz_spec_bench_test.go | Go | go | 2,261 | permissive | package autogenerated
import (
"io/ioutil"
"testing"
"github.com/ghodss/yaml"
"github.com/prysmaticlabs/go-ssz"
)
func BenchmarkBeaconBlock_Marshal(b *testing.B) {
b.StopTimer()
s := &SszBenchmarkBlock{}
populateStructFromYaml(b, "./yaml/ssz_single_block.yaml", s)
b.StartTimer()
for n := 0; n < b.N; n++ {
... |
1cbb230eccf07e45d8f7daae537342ed561d18e9 | f5ff7e860f45ceb680dbfec2dfcd8f37a1fb13c1 | sunmi-OS/gocore | /tools/gocore/file/file.go | Go | go | 1,071 | permissive | package file
import (
"os"
"strings"
"unicode"
)
// MkdirIfNotExist makes directories if the input path is not exists
func MkdirIfNotExist(dir string) error {
if len(dir) == 0 {
return nil
}
if _, err := os.Stat(dir); os.IsNotExist(err) {
return os.MkdirAll(dir, os.ModePerm)
}
return nil
}
// CheckFileIs... |
12c8fb1ad5a665032b36f7e2164a23fbd3e1e74f | 9cb2f204b813fa42a3bd53800c8e8f5349dfbbd4 | AccelByte/accelbyte-go-sdk | /iam-sdk/pkg/iamclient/roles/admin_add_role_permissions_v3_parameters.go | Go | go | 5,876 | permissive | // Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.
// Code generated; DO NOT EDIT.
package roles
import (
"context"
"net/http"
"time"
"github.com/AccelByte/accelbyte-go-sdk/services... |
1d6053704c77158c62c16a88923c355b45f50a29 | bf2b661a49dd0a3826cbe868d5de448477273d2f | rootshaxor/via | /main.go | Go | go | 14,704 | permissive | package main
import (
"fmt"
"github.com/mrosset/gurl"
"github.com/mrosset/util/console"
"github.com/mrosset/util/file"
"github.com/mrosset/util/json"
"github.com/mrosset/via/pkg"
viaplugin "github.com/mrosset/via/pkg/plugin"
"gopkg.in/urfave/cli.v2"
"log"
"os"
"os/exec"
"path/filepath"
goplugin "plugin"
... |
17ea7ce7e344a2b18345df85057865dcba9c752c | 995331195bd5ae623a2b807eb91dffe4edc0eb77 | krzemienski/Konfigurator | /pkg/apis/konfigurator/v1alpha1/types.go | Go | go | 1,664 | permissive | package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type Phase string
const (
PhaseInitial Phase = ""
PhaseRendering Phase = "Rendering"
PhaseCreatingConfigMap Phase = "CreatingConfigMap"
PhaseRendered Phase = "Rendered"
)
type RenderTarget string
const (
Rend... |
06e44e9701fd9c219aa563f333dcdac193d2d6c0 | 405a21486e2435c8b6cde3e12db4775fbeaa4719 | jerry-tom/bk-bcs | /bcs-mesos/bcs-scheduler/src/manager/sched/task/executor.go | Go | go | 8,209 | permissive | /*
* Tencent is pleased to support the open source community by making Blueking Container Service available.
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obta... |
90c44abd17301da2b3754fd72016035f4265c4ca | 36c5a9eda74f202889416ecda686d900cbb3b1d7 | nansystem/mysql-test | /app/cmd/product/main.go | Go | go | 333 | no_license | package main
import (
"log"
_ "github.com/go-sql-driver/mysql"
"github.com/nansystem/mysql-test/infra"
usecase "github.com/nansystem/mysql-test/usecase/product"
)
func main() {
err := infra.InitDB("root:password@tcp(db:3306)/devdb")
if err != nil {
log.Fatal(err)
}
defer infra.Close()
usecase.FillProduct... |
a884d8019d77a32684bac390938b1d7bb3f61109 | 9c7257b7592acef24c4b6eaa7a27a4dd8816fbef | tiwillia/kubernetes | /test/e2e/rc.go | Go | go | 3,832 | permissive | /*
Copyright 2015 The Kubernetes 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 ag... |
48dbb393d8f96a4328a6405080396936e7cd6005 | c76425c7f7aba20a5c8b81a635bdcbd9819fc617 | sudeepgoyal75/terraform-provider-nuagenetworks | /5.3.1/nuagenetworks/data_source_nuagenetworks_floatingipacltemplateentry.go | Go | go | 8,838 | no_license | package nuagenetworks
import (
"fmt"
"github.com/hashicorp/terraform/helper/schema"
vspk "github.com/tpretz/vspk-go/vspk/5.3.1"
"github.com/nuagenetworks/go-bambou/bambou"
)
func dataSourceFloatingIPACLTemplateEntry() *schema.Resource {
return &schema.Resource{
Read: dataSourceFloatingIPAC... |
60823896aa4cdff2be98e9b23844fe61cb28d916 | 8ab70f419428a4bc69c628427d567b89e0f5e34f | jangocheng/zcli | /src/cliAction/buildDeploy/handler_deploy.go | Go | go | 1,756 | no_license | package buildDeploy
import (
"bytes"
"context"
"fmt"
"github.com/zerops-io/zcli/src/i18n"
"github.com/zerops-io/zcli/src/utils"
"github.com/zerops-io/zcli/src/zeropsApiProtocol"
)
func (h *Handler) Deploy(ctx context.Context, config RunConfig) error {
serviceStack, err := h.checkInputValues(ctx, config)
if... |
d9d65dfc84f07625680675b313a4be8e822ffcf6 | 067c9be2ae6379a4fcc3c50c044dd448b37664b3 | sh19910711/hello-go-fuse | /main.go | Go | go | 1,522 | no_license | // ref: https://github.com/hanwen/go-fuse/blob/e73817414197884414aad76cf99983fa442ee3ce/example/hello/main.go
package main
import(
"flag"
"log"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse/nodefs"
"github.com/hanwen/go-fuse/fuse/pathfs"
)
type HelloFs struct {
pathfs.FileSystem
}
fun... |
2845c37e612ebcf3458caaf82c1975af2aeeed92 | 485785f6bb7ebaaa6f93425b3a6209b36926dd48 | xusenlin/forarun | /api/func_api.go | Go | go | 2,450 | no_license | package api
import (
"fmt"
"log"
"math/rand"
"time"
"igo.pub/domain"
"igo.pub/errors"
"igo.pub/platform"
)
func init() {
platform.GetBluepoint("/api/func").
// 每日打卡
SessionPostMapping("/daily-clock", dailyClock).
// 鼓励主题作者
LeaderPostMapping("/encourage-topic-author", encourageTopicAuthor)
}
// 打卡
fu... |
3dad6c3b088b6d9a2e60e7f8b14378e1a8a8c024 | 064df61c66efaf149318b252410ee310bca5c646 | radanalyticsio/oshinko-cli | /vendor/github.com/openshift/origin/pkg/templateservicebroker/servicebroker/provision.go | Go | go | 13,353 | permissive | package servicebroker
import (
"net/http"
"reflect"
"time"
"github.com/golang/glog"
authorizationv1 "k8s.io/api/authorization/v1"
kapiv1 "k8s.io/api/core/v1"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apiserver/pkg/aut... |
7ab1ecf4c131ae238400006524622cc6a3dffc14 | 08da56d85c776fc29ce9d4479238417e700f236e | ThousandSunnyCat/HelloWorld | /src/leetcode/mergaTwoList.go | Go | go | 545 | no_license | package leetcode
func MergeTwoList(l1, l2 *ListNode) *ListNode {
// 边界条件不要漏
if l1 == nil {return l2}
if l2 == nil {return l1}
// 递归,会消耗栈空间,故空间复杂度为 O(n+m)
k := &ListNode{}
mergeList(k, l1, l2)
return k.Next
}
func mergeList(k, l1, l2 *ListNode) {
if l1 == nil || l2 == nil {
if l1 != nil {
k.Next = l1
... |
eb6089ad36577721b86c2a124a716baac527b4f1 | 330587e542a14b0dd13934c8ce733e9fbceb09db | acidlemon/mirage-ecs | /reverseproxy_test.go | Go | go | 2,544 | permissive | package mirageecs_test
import (
"context"
"testing"
"github.com/google/go-cmp/cmp"
mirageecs "github.com/acidlemon/mirage-ecs"
)
func TestReverseProxy(t *testing.T) {
ctx := context.Background()
cfg, err := mirageecs.NewConfig(ctx, &mirageecs.ConfigParams{
Domain: "example.net",
})
if err != nil {
t.Err... |
75d94abeda5970764302dbc16ac1da149847ee4c | 0e8290694a9319b54bf4d434cdfc0e7354266208 | FRINXio/magma | /orc8r/cloud/go/services/metricsd/prometheus/configmanager/prometheus/server.go | Go | go | 2,049 | permissive | /*
* Copyright (c) Facebook, Inc. and its affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
package main
import (
"flag"
"fmt"
"net/http"
"strconv"
"magma/orc8r/cloud/go/services/metrics... |
d2258c2d88a02d7f616ed4c0b6380d0d43f59f01 | 44e1e13e926f4597ccc99e9216749b07299a1419 | pchavanne/yarpc-go | /encoding/protobuf/error.go | Go | go | 6,708 | permissive | // Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
40b4b5f123484ec2cc414f8b62c4f7a89bdf72d1 | 5abb1e13129096d0377e351ee370e70f16b0bc94 | ana13-maker/google-api-go-client | /firebasedynamiclinks/v1/firebasedynamiclinks-gen.go | Go | go | 83,176 | permissive | // Copyright 2020 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package firebasedynamiclinks provides access to the Firebase Dynamic Links API.
//
// For product documentation, see: https://firebase.google.co... |
d3a6d086428157b0efdc3f89c55428dc909af451 | f8c984faecfa09e28bd5ab9147c2b0318ce8dc04 | sohee227/fabric-go-rest-api | /routes/v1/resources/store.go | Go | go | 872 | no_license | package resources
import (
"encoding/json"
"net/http"
"fabric-go-rest-api/models"
"fabric-go-rest-api/hyperledger"
ResourcesModel "fabric-go-rest-api/models/v1/resources"
)
func Store(clients *hyperledger.Clients) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var resource models.... |
e2bb16b5b1adb6b3f6a1f0a9aa6c44b0db35c4ba | 4cafff4d3b2c7426252f0c938af4e553bc8808c1 | powerunit-io/platform | /workers/worker.go | Go | go | 643 | no_license | // Copyright 2015 The PowerUnit 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 workers ...
package workers
import (
"github.com/powerunit-io/platform/config"
"github.com/powerunit-io/platform/logging"
)
// WorkerBase ... |
d43a21e4f8c9468e0b32d4705a5bae7cbf525833 | 830e4d478e99c8bf511813c47347f53ce956aeed | pvijayaragav/contrail-manager | /pkg/apis/contrail/v1alpha1/kubemanager_types.go | Go | go | 1,567 | no_license | package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// KubemanagerSpec defines the desired state of Kubemanager
// +k8s:openapi-... |
d016e0502591bac28e79edfe3ddd4c567511054f | 32609e6e5a3d4091e893c0e67c560ce1e56cb1f3 | jskelcy/gazette | /v2/pkg/client/retry_reader.go | Go | go | 5,933 | permissive | package client
import (
"bufio"
"context"
"errors"
"io"
"time"
pb "github.com/LiveRamp/gazette/v2/pkg/protocol"
log "github.com/sirupsen/logrus"
)
// RetryReader wraps Reader with error handling and retry behavior, as well as
// support for cancellation of an ongoing Read or Seek operation. RetryReader
// is ... |
c8349111b1d0d0d7166455b4a52e9afacaf801f7 | daf86f0febd963dfd5494784cdd09f739ae21d56 | NVIDIA/gpu-operator | /controllers/state_manager.go | Go | go | 34,422 | permissive | package controllers
import (
"context"
"fmt"
"os"
"path/filepath"
"strings"
secv1 "github.com/openshift/api/security/v1"
promv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
gpuv1 "github.com/NVIDIA/gpu-operator/api/v1"
"gith... |
9ac309b6a36169fa6b60387a0e5f74939558ea26 | dc9add1e141508f694088b5a68c5bfab74dda563 | pghildiy/devtron | /client/jira/JiraClient.go | Go | go | 4,491 | permissive | /*
* Copyright (c) 2020 Devtron Labs
*
* 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... |
5ae1df13b6b9819534a9cab923751c5d8a1859b0 | b99cb6d233f3e1b2ba419de15776e3362905e95d | fwtpe/owl-backend | /modules/mysqlapi/service/hbscache/gitupdate.go | Go | go | 633 | permissive | package hbscache
import (
"sync"
db "github.com/fwtpe/owl-backend/modules/mysqlapi/rdb/hbsdb"
log "github.com/sirupsen/logrus"
)
type SafeGitRepo struct {
sync.RWMutex
gitRepo string
}
var GitRepo = &SafeGitRepo{gitRepo: ""}
func (this *SafeGitRepo) Get() string {
this.RLock()
defer this.RUnlock()
log.Debu... |
f3d0d1f43de8fae4ba17a7d4145a711bffc18f13 | a56a2ac17db2610b29899704d3c056a41b068c1a | zhanggbj/bosh-cli | /deployment/disk/manager_test.go | Go | go | 7,045 | permissive | package disk_test
import (
"errors"
fakebicloud "github.com/cloudfoundry/bosh-cli/cloud/fakes"
biconfig "github.com/cloudfoundry/bosh-cli/config"
. "github.com/cloudfoundry/bosh-cli/deployment/disk"
bidisk "github.com/cloudfoundry/bosh-cli/deployment/disk"
bideplmanifest "github.com/cloudfoundry/bosh-cli/deploy... |
fa6aad72ae2e76aa1bebeacc87b6e6ff5531597c | de17a0b598909c5925a9870c3c4ca53254e9596f | aprasolova/neo-go | /pkg/core/interop/runtime/util.go | Go | go | 1,962 | permissive | package runtime
import (
"errors"
"github.com/nspcc-dev/neo-go/pkg/core/interop"
"github.com/nspcc-dev/neo-go/pkg/core/state"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
)
// GasLeft returns remaining amount of GAS.
func GasLeft(ic ... |
66c2c167ca6a338837688df832b57e1aa71b4fb0 | e7fd28ed33aaecca2be86ad0694a5551b2d114ba | iswangwenbin/trigger | /main.go | Go | go | 2,477 | permissive | package main
import (
"fmt"
"github.com/micro/go-micro/config"
cryptoSSH "golang.org/x/crypto/ssh"
"gopkg.in/go-playground/webhooks.v5/gitlab"
"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing/transport"
gitHTTP "gopkg.in/src-d/go-git.v4/plumbing/transport/http"
"gopkg.in/src-d/go-git.v4/plumbing/t... |
b39a004f7149f324638bce31cba66c8b70562140 | 4a2bc5c68a95dd4841e0dbae454131a266efaa16 | mangelajo/submariner | /pkg/util/util_test.go | Go | go | 7,052 | permissive | package util_test
import (
"net"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
subv1 "github.com/rancher/submariner/pkg/apis/submariner.io/v1"
"github.com/rancher/submariner/pkg/types"
"github.com/rancher/submariner/pkg/util"
)
var _ = Describe("Util", func() {
Describe("Function ParseSecure", testPa... |
4abf7c42fbbc2932b88e9ecedf216aaf43a1e1f3 | a95ebfd5b22bccd4412084caddb834de7503af26 | shanbay/ent | /entc/internal/snapshot.go | Go | go | 6,574 | permissive | // Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
package internal
import (
"bytes"
"encoding/json"
"fmt"
"os"
"strings"
"entgo.io/ent/entc/gen"
"entgo.io/ent/entc/lo... |
a4721293150af7cd196594683f3bc592a6195f9c | e6750168534ab1c9a2c47be28a0409db2fe29698 | mytxd/vfilter | /vfilter_test.go | Go | go | 19,512 | permissive | package vfilter
import (
"context"
"encoding/json"
"fmt"
"reflect"
"testing"
"github.com/Velocidex/ordereddict"
"github.com/sebdah/goldie"
"github.com/stretchr/testify/assert"
)
const (
PARSE_ERROR = "PARSE ERROR"
)
type execTest struct {
clause string
result Any
}
var execTestsSerialization = []execTes... |
74b46140029b84fb32a9c39903ea241a996e6d16 | 4c574434b84be8be2febffdc50ad834c7576d4aa | anguslees/kube-prod-runtime | /kubeprod/pkg/installer/install.go | Go | go | 7,375 | permissive | /*
* Bitnami Kubernetes Production Runtime - A collection of services that makes it
* easy to run production workloads in Kubernetes.
*
* Copyright 2018 Bitnami
*
* 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... |
a6850ef3ddc577df748ff23c378b9b71cddf3f42 | 5e422962d0aa01b4e24e9939d1cd7a010505a7c1 | tomzhang/aistore | /tutils/readers.go | Go | go | 8,018 | permissive | // Package tutils provides common low-level utilities for all aistore unit and integration tests
/*
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
*/
package tutils
import (
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
"math/rand"
"os"
"path"
"time"
"github.com/NVIDIA/aistore/cmn"
"github.com/... |
c9f18b887c7675373a2b4199655d92b3191ae7f8 | ea847518efe48118c2b54cf057e234ad1960f426 | alxmk/adventofcode | /2019/day14/main_test.go | Go | go | 4,573 | no_license | package main
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestRecipes_getMaterials(t *testing.T) {
tests := []struct {
name string
input string
chem chemical
expectRaw []chemical
}{
{
name: "Ex1",
input: `10 ORE => 10 A
1 ORE ... |
3c6f40bd7376dfe16fe2da271010f0c0661d67af | 0a450f5dafba77f7d67ea2113263dc84bfc3371f | ygurumi/ecs-task-metadata-exporter | /apis/v2/types.go | Go | go | 2,809 | permissive | package v2
type NetworkMetadata struct {
NetworkMode string `json:"NetworkMode"`
IPv4Addresses []string `json:"IPv4Addresses"`
}
type ContainerMetadata struct {
DockerID string `json:"DockerId"`
Name string `json:"Name"`
DockerName string `json:"DockerName... |
a979418a7200bc69e433a8bde0073003b4809038 | d8af31f560cdc61bc5fc8ab919c315d61fce2f91 | Superzhaoooo/PlatoonTest | /blockchain/client.go | Go | go | 855 | no_license |
package blockchain
import (
"fmt"
"github.com/hyperledger/fabric-sdk-go/pkg/fabsdk"
"github.com/hyperledger/fabric-sdk-go/api/apitxn/chclient"
)
//the purpose of this struct is basically the same as FabricSetup, but all of the admin information is stripped
type ClientSetup struct {
ChainCodeID string
U... |
5e5d4475f60a45322308a2aaea0d0c5f9455fc02 | e02a08d4baddd1c53a835206efa8ccdc5ec2c6c8 | reinhardtken/browser-test | /src/main/main.go | Go | go | 1,035 | no_license | package main
import (
"github.com/gin-gonic/gin"
"net/http"
)
/*
build
export GOARCH=amd64
export GOOS=linux
go build -o aldServer ./server.go
set path=C:\Go1.12\bin;%path%
set GOROOT=C:\Go1.12
set GOARCH=amd64
set GOOS=linux
go build -o aldServer ./server.go
*/
func main() {
//router1####################... |
b708bf5f36fe7c305b955bde1ad4fe3c4095b4fe | d36e768047a3b1d87f54867877fa03e972277723 | huaweicloud/huaweicloud-sdk-go-v3 | /services/sdrs/v1/sdrs_invoker.go | Go | go | 15,849 | permissive | package v1
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/invoker"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/sdrs/v1/model"
)
type AddProtectedInstanceNicInvoker struct {
*invoker.BaseInvoker
}
func (i *AddProtectedInstanceNicInvoker) Invoke() (*model.AddProtectedInstanceNicResponse, err... |
65d6c98b072fb3800e16ab4af7f80242baf57ed2 | 8436f3db5782003040c3108609a1c34e7e08b306 | Venafi/vcert | /pkg/venafi/cloud/connector_test.go | Go | go | 71,979 | permissive | /*
* Copyright 2018 Venafi, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... |
9e3fbd5e0d27edee734c5e149b679904d2addc0a | 707e70bb11ed797b309a957300ee4863ff0ef424 | jensim/sourcegraph | /internal/db/dbutil/dbutil.go | Go | go | 14,126 | permissive | package dbutil
import (
"context"
"database/sql"
"database/sql/driver"
"encoding/hex"
"encoding/json"
"fmt"
"net/url"
"os"
"strconv"
"strings"
"time"
// Register driver
"github.com/lib/pq"
"github.com/golang-migrate/migrate/v4"
"github.com/golang-migrate/migrate/v4/database/postgres"
bindata "github.... |
ce600f91904c2fda803d34c815e70df86ab4cbdd | 862330138e0725c6162d91cfab7038af1d8bec70 | jenn4432/mmake | /cmd/mmake/mmake.go | Go | go | 1,727 | permissive | package main
import (
"bytes"
"io/ioutil"
"os"
"os/exec"
"syscall"
"github.com/apex/log"
"github.com/apex/log/handlers/cli"
"github.com/segmentio/go-env"
"github.com/tj/mmake/help"
"github.com/tj/mmake/installer"
"github.com/tj/mmake/resolver"
)
func init() {
log.SetHandler(cli.Default)
log.SetLevel(lo... |
3b14370e72992426aa4231a3fa3766030fac3d78 | 01e80193848dc536d15cf382c502c0d989af3bc6 | Cepave/open-falcon-backend | /common/service/nqm/agent.go | Go | go | 1,328 | permissive | package nqm
import (
"fmt"
cache "github.com/Cepave/open-falcon-backend/common/ccache"
nqmDb "github.com/Cepave/open-falcon-backend/common/db/nqm"
nqmModel "github.com/Cepave/open-falcon-backend/common/model/nqm"
)
type AgentService struct {
cache *cache.CacheCtrl
cacheConfig *cache.DataCacheConfig
}
fun... |
3e731732ce268849da122916386ec59fdf1246bb | 5b919c735d57d728494465beada6c5dbb68f21d6 | pivotal/skenario | /sim/pkg/plugin/plugin.go | Go | go | 1,413 | permissive | package plugin
import (
"github.com/josephburnett/sk-plugin/pkg/skplug"
"github.com/josephburnett/sk-plugin/pkg/skplug/dispatcher"
"github.com/josephburnett/sk-plugin/pkg/skplug/proto"
"strconv"
"sync/atomic"
)
type PluginPartition interface {
Event(time int64, typ proto.EventType, object skplug.Object) error
... |
8c1a2f76e16d3ea4fefd92d96eef27b5fb8a5c54 | d510e99deaf9380d8d967fb93af4a8f9f785275d | kopancek/sourcegraph | /internal/workerutil/worker_test.go | Go | go | 15,465 | permissive | package workerutil
import (
"context"
"fmt"
"sync"
"testing"
"time"
"github.com/cockroachdb/errors"
"github.com/derision-test/glock"
"github.com/sourcegraph/sourcegraph/internal/observation"
)
type TestRecord struct {
ID int
State string
}
func (v TestRecord) RecordID() int {
return v.ID
}
func Tes... |
f3b84a07f8ad9ae0273ff737968a2410a4228045 | d61be271a140282d1564d1a4127945637a936058 | LINBIT/stork | /vendor/github.com/libopenstorage/autopilot-api/pkg/apis/autopilot/v1alpha1/autopilotrule.go | Go | go | 9,772 | permissive | package v1alpha1
import (
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// LabelSelectorOperator is the set of operators that can be used in a selector requirement.
type LabelSelectorOperator string
const (
// AutopilotRuleResourceName is the name of the singular AutopilotRule objects
AutopilotRuleResourceName = ... |
51c9e51e8a6fd883545954d821da7d5c43825c66 | fd74fb3dedfd10d81b316398ae132609b4f559ff | deepsec-inc/deepchain | /protos/ledger/rwset/kvrwset/tests/kv_rwset_test.go | Go | go | 2,941 | 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... |
2cc66bad3b38a16d79476bf3cbe84a0460c510b1 | 41dd4223c60d37997f016d4c87712144bce57a9d | cr0sh/dojangsearch | /dojangserver/main.go | Go | go | 15,675 | no_license | package main
import (
"encoding/binary"
"encoding/json"
"flag"
"fmt"
"github.com/boltdb/bolt"
"github.com/robfig/cron"
"github.com/tucnak/telebot"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"os/signal"
"strconv"
"strings"
"sync"
"time"
"unicode"
"unsafe"
)
const timeFormat = "2006-01-02 15:0... |
efee0304143da8bf46c2e678c15bd16a62db6545 | 0d69ce5a5a96c322957759125dea71e9773531db | caseydavenport/operator | /api/v1/manager_types.go | Go | go | 3,168 | permissive | // Copyright (c) 2020-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 applicable law or ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.