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 |
|---|---|---|---|---|---|---|---|---|
96178386efb80af15520b7da0aa0471ef5e1ca9b | da86aeb447ff1f487cb5630876bb33da574ad0ff | g10guang/LeetCode | /graph/maxAreaOfIsland_test.go | Go | go | 432 | no_license | package graph_test
import (
"testing"
"github.com/g10guang/leetcode/graph"
)
func TestMaxAreaOfIsland(t *testing.T) {
suits := []struct{
input [][]int
expect int
} {
{[][]int{{1,1,0,0,0}, {1,1,0,0,0}, {0,0,0,1,1}, {0,0,0,1,1}}, 4},
{[][]int{{0,1,1}}, 2},
}
for _, s := range suits {
if r := graph.MaxAr... |
b5b3b63179cf7e1b3ebba637f6c4e8333ddf7995 | 7cc25a8b607dd4c437a96b9b12224bfb1c937ed9 | Raneet10/RequestMoney | /x/requestmoney/client/rest/rest.go | Go | go | 750 | no_license | package rest
import (
"github.com/gorilla/mux"
"github.com/cosmos/cosmos-sdk/client/context"
)
// RegisterRoutes registers requestmoney-related REST handlers to a router
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router) {
// this line is used by starport scaffolding # 1
r.HandleFunc("/requestmoney/re... |
d0e1185eff23d177ce92d26b7a6cf06a8db0d7ed | 94e3654cb96dfacd9bcfb2fb4401fc6f6a6b773a | jojopoper/CoinReader | /aex/trade/exsample/main.go | Go | go | 1,828 | no_license | package main
import (
"time"
_b "github.com/jojopoper/CoinReader/aex/trade"
// _c "github.com/jojopoper/CoinReader/common"
_L "github.com/jojopoper/xlog"
)
func main() {
_L.LogInstance = _L.CreateDefaultLogInstance("ex.log", 5)
_L.Info("Begin read aex ...")
key := "key"
skey := "skey"
uid := "uid"
trade1(k... |
1d8f5df3841c3a87a4779022adbdb66aa478ffd7 | 63557296d0befa298ba263e4a07bf96b2bca8b47 | avinashdesireddy/go-playground | /examples/writing-files.go | Go | go | 1,250 | no_license | package main
import (
"bufio"
"fmt"
"io/ioutil"
"os"
)
func check(e error) {
if e != nil {
panic(e)
}
}
func main() {
// To start, here's how to dump a string (or just
// bytes) into a file.
d1 := []byte("hello\ngo\n")
err := ioutil.WriteFile("/tmp/dat1", d1, 0644)
... |
2a30d3abdf30f7beca54a5dc3bb80816c4c4ac74 | 506c6d852132c44c76524c324ada435c110437f1 | ablohowiak-fanhattan/goagain | /goagain.go | Go | go | 4,227 | permissive | // Zero-downtime restarts in Go.
package goagain
import (
"errors"
"fmt"
"log"
"net"
"os"
"os/exec"
"os/signal"
"reflect"
"syscall"
)
var (
// OnSIGHUP is the function called when the server receives a SIGHUP
// signal. The normal use case for SIGHUP is to reload the
// configuration.
OnSIGHUP func(l net... |
2789b03802d7a6ddcc889c85ba1b55c9f0ca6bd6 | 685ae2c6a521c7b32874e4c1bc711264d588885d | dell03/mymove | /pkg/services/ghcrateengine/domestic_destination_shuttling_pricer_test.go | Go | go | 4,355 | permissive | package ghcrateengine
import (
"fmt"
"strconv"
"time"
"github.com/transcom/mymove/pkg/models"
"github.com/transcom/mymove/pkg/services"
"github.com/transcom/mymove/pkg/testdatagen"
"github.com/transcom/mymove/pkg/unit"
)
const (
ddshutTestServiceSchedule = 2
ddshutTestBasePriceCents = unit.Cents(... |
f9a9fc31ee5ff042c14444d4422583c82475e3e2 | 6f2e2751a27ac77e25e936ed1507ff9ee2bd9ff9 | cbaermann/GoLang_WebDev | /routing/thirdPartyServeMux/main.go | Go | go | 2,019 | no_license | package main
import (
"fmt"
"html/template"
"log"
"net/http"
"github.com/julienschmidt/httprouter"
)
var tpl *template.Template
func init() {
tpl = template.Must(template.ParseGlob("templates/*"))
}
func main() {
mux := httprouter.New()
mux.GET("/", index)
mux.GET("/about", about)
mux.GET("/contact", con... |
28a9d41a80ed3b7e4495e2f0952d1f2d063a1e32 | 84e5ef2882ff71f947699785564241eb11c8bc28 | jeffbmartinez/timeline | /Godeps/_workspace/src/github.com/influxdb/influxdb/influxql/engine.go | Go | go | 28,069 | permissive | package influxql
import (
"bytes"
"errors"
"fmt"
"hash/fnv"
"math"
"sort"
"time"
)
// DB represents an interface for creating transactions.
type DB interface {
Begin() (Tx, error)
}
const (
// Return an error if the user is trying to select more than this number of points in a group by statement.
// Most l... |
a484bb7488f491b800fbc7b81e9a571448dc6648 | 1065b33498b0c9d1e7a31fec461de59b643a4928 | ESPOIR-DITE/marilynWorkout | /io/nutrition_io/nutritionUserPlan_io.go | Go | go | 2,086 | no_license | package nutrition_io
import (
"errors"
"marilynWorkout/api"
"marilynWorkout/domain/nutrition"
)
const nutritionUserPlanURL = api.BASE_URL + "nutrition/ "
func CreateNutritionUserPlan(nutritionObject nutrition.NutritionUserPlan) (nutrition.NutritionUserPlan, error) {
entity := nutrition.NutritionUserPlan{}
resp,... |
723ae72e1eaaf524fa58b7e1e9444794208069ba | aaf3623162b20e233e8232ba18d6a0a195591f15 | linhailan/luci-go | /lucicfg/duration.go | Go | go | 3,571 | permissive | // Copyright 2019 The LUCI 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... |
390e3c70b4bc5a42fe86ee598d8fb8f6087a61ca | df49070b385937f0234c19ae501bfb1976155be3 | OliRac/portfolio | /src/page_build.go | Go | go | 1,102 | no_license | package main
/*Makes use of a local postgreSQL database to fill out resume data with the given language
Errors are handled in Database methods*/
func BuildResume(lang string) *ResumeData{
var db Database
db.Connect()
defer db.Disconnect()
headers := db.GetSectionHeaders(lang)
edu := EduSection{
Header: heade... |
d2a95db60631b2bf9019feda9cb1d7542a87edd4 | d2bff0c43c1b2e19575d11786e0067edef6c9c1f | jumping/gopm | /cmd/cmd.go | Go | go | 1,969 | permissive | // Copyright 2013 gopm 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... |
a163d9da973831c5472fdc561537523721228a0d | 6486540f5dd93866b9eac8bda9bd5912ec6791ff | macarrie/flemzerd | /db/db.go | Go | go | 7,527 | permissive | // Package db provides access to local database and gives some shortcuts for getting certain types of objects
// The ultimate goal is to create an abstraction layer for data access so an underlying database structure change does not require to change the entire codebase
package db
import (
"os"
log "github.com/maca... |
7711334308ea144fb958ebe1c10557ad764ae65e | c7c4e3db0bb025ac4d8779b9f832e5cad986b829 | M-Mortaz/personal-accounting | /tests/default_test.go | Go | go | 975 | no_license | package test
import (
"net/http"
"net/http/httptest"
_ "p_accounting/routers"
"path/filepath"
"runtime"
"testing"
beego "github.com/beego/beego/v2/server/web"
. "github.com/smartystreets/goconvey/convey"
)
func init() {
_, file, _, _ := runtime.Caller(0)
apppath, _ := filepath.Abs(filepath.Dir(filepath.Joi... |
e109fa29f2651c523cd493a252024357cc90ef75 | ba25afa8c109f5c85a9e010543c6da5ff5493895 | fanfuxiaoran/gpbackup | /backup/metadata_globals_test.go | Go | go | 26,469 | permissive | package backup_test
import (
"github.com/greenplum-db/gp-common-go-libs/testhelper"
"github.com/greenplum-db/gpbackup/backup"
"github.com/greenplum-db/gpbackup/testutils"
. "github.com/onsi/ginkgo"
)
var _ = Describe("backup/metadata_globals tests", func() {
emptyDB := backup.Database{}
BeforeEach(func() {
t... |
8e331a19d7654420c3ba630de325f3b3a3d2345c | a5969332aaa89b6a3de02e7d03c17d0c260b6dec | kubernetes/kubernetes | /vendor/github.com/cilium/ebpf/btf/btf.go | Go | go | 22,361 | permissive | package btf
import (
"bufio"
"bytes"
"debug/elf"
"encoding/binary"
"errors"
"fmt"
"io"
"math"
"os"
"reflect"
"github.com/cilium/ebpf/internal"
"github.com/cilium/ebpf/internal/sys"
"github.com/cilium/ebpf/internal/unix"
)
const btfMagic = 0xeB9F
// Errors returned by BTF functions.
var (
ErrNotSupport... |
edc9db438f3841d9d99c89ece10d12a13351952d | e3b61b9d187a1b19a047f7fd71c8b6c388bc1185 | ilanpillemer/adventofcode2015 | /go/7/main.go | Go | go | 2,633 | no_license | package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
var wires = map[string]uint16{}
type Op int
const (
NONE Op = iota
AND
LSHIFT
RSHIFT
OR
NOT
)
type statement struct {
gate string
wire string
executed bool
}
var prog = []statement{}
func main() {
in := bufio.NewScanner(os.Stdi... |
f78e26398b8338dd75bf65b0c22c36247f96c030 | b02d5356d5c118fa7facbce135723dda17b3760c | fossabot/allhic | /build.go | Go | go | 4,557 | permissive | /**
* Filename: /Users/htang/code/allhic/build.go
* Path: /Users/htang/code/allhic
* Created Date: Saturday, January 27th 2018, 10:21:08 pm
* Author: htang
*
* Copyright (c) 2018 Haibao Tang
*/
package allhic
import (
"bufio"
"fmt"
"io"
"os"
"strings"
"github.com/shenwei356/bio/seq"
"github.com/shenwei... |
65b95ace7869dc49407453d0997c184391de10f6 | 6d29014800718124ac983cf04c1e90c74873d9df | axcoto/di-tui | /difm/difm.go | Go | go | 5,423 | permissive | package difm
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"github.com/acaloiaro/di-tui/context"
"github.com/acaloiaro/di-tui/components"
"github.com/acaloiaro/di-tui/config"
"github.com/bradfitz/iter"
"github.com/faiface/beep"
"github.com/faiface/beep/... |
8049b3dfa44f00268169542d7f33d2b337edfbc2 | dd305137ff5cf56cda2bedb1c75e73b5e58ace71 | adityasaky/cosign | /cmd/cosign/cli/attach.go | Go | go | 1,988 | permissive | //
// Copyright 2021 The Sigstore 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 ... |
b555a90d354737d2f8b8214a2886cbda2413d213 | e81c5efa855f36ee0f360601d5e05cf33cc58be5 | zzheffn/m3 | /src/cmd/services/m3dbnode/main/main.go | Go | go | 2,690 | permissive | // Copyright (c) 2016 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
921936e9f4cf06acec86a100df2394c0eabba631 | ce462f513f0124a83cfe8a24fd87575e5fe0e4e3 | yangaowei/goexample | /sort/bubblesort.go | Go | go | 637 | no_license | package main
import (
"fmt"
)
func bubbleSortV1(num []int) {
size := len(num)
for i := 0; i < size; i++ {
for j := 0; j < size-i-1; j++ {
if num[j] > num[j+1] {
num[j], num[j+1] = num[j+1], num[j]
}
}
fmt.Println(num, i)
}
}
func bubbleSortV2(num []int) {
size := len(num)
i := size - 1
for i <... |
76ff67963f6b6a1febe545bcba61089ea48d9e4b | 410e4d7eaf2fd73ba88593399580f6ff0135c2fe | NYULibraries/dlts-finding-aids-zek-generated-code_archived | /sample-set-2-individual-ead-files/tam_629.go | Go | go | 8,610 | no_license | type Ead struct {
XMLName xml.Name `xml:"ead"`
Text string `xml:",chardata"`
Xmlns string `xml:"xmlns,attr"`
Xlink string `xml:"xlink,attr"`
Xsi string `xml:"xsi,attr"`
SchemaLocation string `xml:"schemaLocation,attr"`
Eadheader struct {
Text ... |
45ab8374266bfe33722d1f590b4b1a7bc89d4c10 | 223485e0b343a32632ac9d6c45c5aafafba256bc | hello-zxm/newsSystem | /newsWebSystem/models/user.go | Go | go | 1,007 | no_license | package models
import (
"github.com/astaxie/beego/orm"
_ "github.com/go-sql-driver/mysql"
"time"
)
type User struct {
Id int
Name string
Pwd string
Articles []*Article `orm:"reverse(many)"`
}
type Article struct {
Id int `orm:"pk;auto"`
Title string `orm:"unique;size(50)"`
Content ... |
ad584835d3773804bc567a47113066b4c55169d0 | 6b04438f32a5ea0d6d739e33f2b9c8e028fb7d1c | CcccFz/practice | /golang/high-perf-golang/api-rate-limit/02_with_limiter/main.go | Go | go | 742 | no_license | package main
import (
"context"
"fmt"
"sync/atomic"
"time"
"golang.org/x/time/rate"
)
var (
concurrent int32
)
func hadler() {
atomic.AddInt32(&concurrent, 1)
time.Sleep(50 * time.Millisecond)
return
}
func callHandler() {
limiter := rate.NewLimiter(rate.Every(100 * time.Millisecond), 1)
for {
limiter... |
921541028bb39e179d3c82370b7f4147a696fbb7 | b1779c6b945c12fffa615e163081cb3830a7eb44 | Cloud-Foundations/health-agent | /probers/kernel/api.go | Go | go | 376 | permissive | package kernel
import (
libprober "github.com/Cloud-Foundations/health-agent/lib/prober"
"github.com/Cloud-Foundations/tricorder/go/tricorder"
)
type prober struct {
hostname string
randomEntropyAvailable uint64
}
func Register(dir *tricorder.DirectorySpec) libprober.Prober {
return register(dir)
... |
e00b6d57742aae183edc700d704094a1d98e6892 | 11751930f41a70b035c71aa02da93fdb1efee68b | woraser/cron | /cron.go | Go | go | 7,298 | permissive | package cron
import (
"log"
"runtime"
"sort"
"time"
"errors"
"fmt"
)
// Cron keeps track of any number of entries, invoking the associated func as
// specified by the schedule. It may be started, stopped, and the entries may
// be inspected while running.
const (
DEFAULT_MAXRUN = 10 //the default value for jo... |
e62e8dc40abe0ed12f014ff6da6ec8e39d55ade9 | 3caddfcb29753252a9cfe9cb42686f724f7105a4 | welterde/mudkip | /server/http/http.go | Go | go | 1,720 | permissive | package main
import "os"
import "io"
import "time"
import "strings"
import "fmt"
import "http"
import "path"
func Run(cfg *Config) {
http.HandleFunc("/", httpHandler)
if cfg.Secure {
fmt.Fprintf(os.Stdout, "[i] Listening on %s (secure)\n", cfg.ListenAddr)
if err := http.ListenAndServeTLS(cfg.ListenAddr, cfg.S... |
05dc6423220b962c8083946c4bc4febbfbe4690e | 6fa4eabb51f17ea0ada21f4cd2b2d6cfab12e036 | twkun/amd64 | /tests/movaps_test.go | Go | go | 1,710 | permissive | package tests
import . "github.com/modern-go/amd64"
func init() {
testCases = append(testCases, []testCase{{
input: input{
MOVAPS, XMM1, XMM2,
},
output: []uint8{
aka(0x0f, MOVAPS.Prefix0F()),
aka(0x28, MOVAPS.Opcode()),
aka(0xca, MODRM(ModeReg, XMM1.Value(), XMM2.Value())),
},
}, {
input: inp... |
f0c8d1a76b4aeb8165a1b7b6cc97d6f756692018 | ac5151622a5553590f85174df6d92fd2394fa8ed | stevenchiu30801/free5gc-stage-2 | /lib/nas/nasType/NAS_AuthenticationParameterAUTN_test.go | Go | go | 3,625 | permissive | package nasType_test
import (
"gofree5gc/lib/nas/nasMessage"
"gofree5gc/lib/nas/nasType"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNasTypeNewAuthenticationParameterAUTN(t *testing.T) {
a := nasType.NewAuthenticationParameterAUTN(nasMessage.AuthenticationRequestAuthenticationParameterAUTNType)
a... |
f7807cd2b541c59a478e71211cf4ca379beb1895 | afd5ee7b1765b9241cade55543d42959cb1c79ed | Sypheos/fogflow | /master/cmd/main.go | Go | go | 968 | permissive | package main
import (
"flag"
"math/rand"
"os"
"os/signal"
"strconv"
"syscall"
"github.com/Sypheos/fogflow/master"
)
func generateRandomNum() string {
return strconv.Itoa(rand.Intn(100))
}
func main() {
configurationFile := flag.String("f", "config.json", "A configuration file")
myID := flag.String("i", ""... |
18d00b0833024a247f8c0d8c0b0622e047825a8b | a1b9b1faf0a99405c001e90ca0adae0aeaff2853 | openshift/installer | /terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate/eventhub_partition.go | Go | go | 373 | permissive | package validate
import "fmt"
func ValidateEventHubPartitionCount(v interface{}, _ string) (warnings []string, errors []error) {
value := v.(int)
if !(1024 >= value && value >= 1) {
errors = append(errors, fmt.Errorf("EventHub Partition Count has to be between 1 and 32 or between 1 and 1024 if using a dedicated ... |
c9138a49f51b100864f41bf10941e31670e5940e | f49ebd631dcad6bb94db68460b1c78ccc5a89eef | gitfib/antidot | /internal/rules/export_test.go | Go | go | 1,153 | permissive | package rules_test
import (
"os"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/doron-cohen/antidot/internal/rules"
"github.com/doron-cohen/antidot/internal/shell"
"github.com/doron-cohen/antidot/internal/utils"
)
func TestExportNoEnv(t *testing.T) {
utils.AppDirs.AppName = "antidot_test"
kvPath, err... |
d2c68c2605e90eaae01e558b0b8f56fed8fb863b | e30e7b86fe27c53f9d34517a2fd98da8e6e49ee9 | ocket8888/trafficcontrol | /traffic_ops/testing/api/v5/regions_test.go | Go | go | 15,898 | permissive | package v5
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... |
c7e71b69f565fed44400a1363ec72928b2349103 | 0101e8bc84a244875246ced7d8fd2d2a81052afa | appuio/origin | /pkg/monitor/types.go | Go | go | 1,940 | permissive | package monitor
import (
"fmt"
"sort"
"strconv"
"time"
)
type SamplerFunc func(time.Time) []*Condition
type Interface interface {
Events(from, to time.Time) EventIntervals
Conditions(from, to time.Time) EventIntervals
}
type Recorder interface {
Record(conditions ...Condition)
AddSampler(fn SamplerFunc)
}
... |
952c2327cf66ce092eea73279323aec70d6a98ac | 27420930fb1f2a5256af374355b93716bfe03a24 | jackyalbo/cloud-credential-operator | /vendor/github.com/microsoftgraph/msgraph-sdk-go/users/item/transitivememberof/item/directory_object_item_request_builder.go | Go | go | 8,321 | permissive | package item
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242 "github.com/microsoftgraph/msgraph-sdk-go/models"
ia572726a95efa92ddd544552cd950653dc691023836... |
6c46c34c10d0f69e98a90c81e0c091f941e2e465 | 8f3881487968e26393d52a7c59e435c2d9282af7 | devx/certify | /pkg/certify/certify.go | Go | go | 3,885 | permissive | /*
Copyright 2016 Victor Palma
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
505b5f26144cc86f2b26fc019489aad602dd9239 | c338cd8d28f72fca7d3ebc56dfe366a311647e60 | nawadanp/mongo-bench-collections | /main.go | Go | go | 3,400 | no_license | package main
import (
"flag"
"log"
"os"
"strconv"
"time"
"encoding/csv"
"github.com/globalsign/mgo"
)
type params struct {
MongoURI string
MongoTimeoutMS int
Databases int
Collections int
OutputFile string
}
const (
appName = "mongo-bench-collections"
)
func parseFlags() params {
f... |
1a36981c411e607d483910e6d2f1ce972ba08887 | 4f2b924b78d2d8e47bb75d2ccfc7d4cfe2bec091 | jiaweisizzz/communication-mg | /serial/serial_windows.go | Go | go | 7,581 | no_license | package serial
import (
"fmt"
"os"
"sync"
"syscall"
"time"
"unsafe"
)
type Port struct {
f *os.File
fd syscall.Handle
rl sync.Mutex
wl sync.Mutex
ro *syscall.Overlapped
wo *syscall.Overlapped
}
type structDCB struct {
DCBlength, BaudRate uint32
flags ... |
ac348644d2886748cbc7f1c4c1b326d9fd870091 | 4b7fedf9b77b0f415d34e99526744016def12071 | Andraha/noverify | /src/php/parser/node/stmt/t_class_method_test.go | Go | go | 10,950 | permissive | package stmt_test
import (
"testing"
"gotest.tools/assert"
"github.com/VKCOM/noverify/src/php/parser/node/name"
"github.com/VKCOM/noverify/src/php/parser/position"
"github.com/VKCOM/noverify/src/php/parser/node"
"github.com/VKCOM/noverify/src/php/parser/node/stmt"
"github.com/VKCOM/noverify/src/php/parser/ph... |
c56bd24320763190829e8bc31b73a869fad7a19b | 669350cc420718d0363c4937ec5d61c2b72e9e9f | tychoish/evergreen | /cloud/cloud_host.go | Go | go | 1,709 | permissive | package cloud
import (
"context"
"github.com/evergreen-ci/evergreen"
"github.com/evergreen-ci/evergreen/model/host"
)
//CloudHost is a provider-agnostic host object that delegates methods
//like status checks, ssh options, DNS name checks, termination, etc. to the
//underlying provider's implementation.
type Clou... |
1b77514321f55f4c8fcd5274d1be266494457d18 | 195abd818c6678d8d14dd9b188a1fb373027eea8 | quantflying/incognito-chain | /peerv2/submanager_test.go | Go | go | 9,612 | permissive | package peerv2
import (
"fmt"
"testing"
"github.com/incognitochain/incognito-chain/common"
"github.com/incognitochain/incognito-chain/peerv2/mocks"
"github.com/incognitochain/incognito-chain/peerv2/proto"
"github.com/incognitochain/incognito-chain/wire"
"github.com/libp2p/go-libp2p-core/peer"
pubsub "github.c... |
cd022d8912b36da8e25e552aa7ac8833640d8ef2 | 4657b8fa8243bd7282c1ec248644af4a5620aa01 | cloud1230/testsystem | /vendor/src/github.com/hyperledger/fabric-sdk-go/pkg/cryptosuite/bccsp/pkcs11_test.go | Go | go | 1,264 | permissive | // +build pkcs11
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package bccsp
import (
"testing"
"github.com/golang/mock/gomock"
"github.com/hyperledger/fabric-sdk-go/api/apiconfig/mocks"
"github.com/hyperledger/fabric-sdk-go/pkg/logging/utils"
)
func Test... |
4ae3927bd10dcf26a323a7546de8245a9fa31723 | 8a503bc91793bcc1bd02e5438cac0a49755493f0 | arunsingh/kubernetes | /pkg/proxy/healthcheck/healthcheck.go | Go | go | 9,836 | permissive | /*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
5c3798432c2dea4735c5b788e50b63ae66ba5b08 | 98ff2a3d27a1c3c81f710f8bec0c80f03459b098 | Bhanditz/go-2 | /src/cmd/compile/internal/gc/main.go | Go | go | 42,187 | permissive | // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:generate go run mkbuiltin.go
package gc
import (
"bufio"
"bytes"
"cmd/compile/internal/ssa"
"cmd/compile/internal/types"
"cmd/internal/bio"
"cmd/in... |
ddb89b77b1cc3c097e61a1bc44640280c512cfed | 5e6dfd36e0cfdbbf6b6c1e751d828d96bf4bb442 | moeinmhzg/OpenFlag | /internal/app/openflag/grpc/metric.go | Go | go | 644 | permissive | package grpc
import (
"github.com/OpenFlag/OpenFlag/internal/app/openflag/metric"
prom "github.com/OpenFlag/OpenFlag/pkg/monitoring/prometheus"
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/prometheus/client_golang/prometheus"
)
// nolint:gochecknoglobals
var metrics = grpc_prometheus... |
6a172dd858e5416c5982f087532b18b106b1f8e1 | 5ea612671f2a8446b582638f38e68c80116b7aa7 | Eugene-Fedorenko/prebid-server | /adapters/krushmedia/krushmedia.go | Go | go | 5,092 | permissive | package krushmedia
import (
"encoding/json"
"fmt"
"net/http"
"strconv"
"text/template"
"github.com/mxmCherry/openrtb"
"github.com/eugene-fedorenko/prebid-server/adapters"
"github.com/eugene-fedorenko/prebid-server/config"
"github.com/eugene-fedorenko/prebid-server/errortypes"
"github.com/eugene-fedorenko/pr... |
ab8f76ed905bcf3d251781640ad8ac2fc343fa2b | 85b7a0810129d7faaf10c137899c5d37b0526a40 | Min65535/demo | /dfm-test/pkg/decode/provider.go | Go | go | 391 | no_license | package decode
import (
"github.com/dipperin/go-ms-toolkit/log"
"go.uber.org/zap"
)
func NewAdmJwt() (admJ JwtToken, cf func(), err error) {
var (
cfg struct {
AdmJwtSecret string `json:"adm_jwt_secret" toml:"adm_jwt_secret"`
}
)
admJ, err = NewJwtToken(cfg.AdmJwtSecret)
if err != nil {
log.QyLogger.E... |
91a70d59629826a62b7c8bfd2d7f8ad02711230d | ed3ab05d611f3b67704219ff322a60cb94a53416 | hzxiao/neo-thinsdk-go | /neo/base58_test.go | Go | go | 830 | no_license | package neo
import (
"bytes"
"testing"
)
func TestB58encoding(t *testing.T) {
checkB58Encoding(t, []byte("1"))
checkB58Encoding(t, []byte("hello world"))
}
func checkB58Encoding(t *testing.T, data []byte) {
e := b58encode(data)
d, err := b58decode(e)
if err != nil {
t.Fatal(err)
}
if !bytes.Equal(data... |
155847d322b5a1a2cb6557d830c6a3c3f648a5be | d60bfeace62fd45133c39b360eb460bda6ddc01e | sgtest/monorepo-test-3 | /kubernetes-11/federation/client/clientset_generated/federation_clientset/typed/extensions/v1beta1/ingress.go | Go | go | 5,483 | permissive | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
0984b445bcb46d1cee4b76d6c67898f9374a0be5 | 8c0287b55b225d267e7c17c91b384df84735c8e0 | icodus/cmd-1 | /internal/cmd/split_test.go | Go | go | 756 | permissive | package cmd
import (
"reflect"
"testing"
)
func TestSplit(t *testing.T) {
cases := [...]struct {
command string
cmd string
args []string
}{
// i=0
{
`"C:/Program Files/Git/bin/git.exe" checkout HEAD~1 'a file' another\ file`,
`C:/Program Files/Git/bin/git.exe`,
[]string{`checkout`, `HEAD... |
88969d0e8c1a71783efb029b1c7ffaa98bccbf28 | e983e0b7fd8e72ae23040d1b678543c9adca78d6 | geekflyer/pulumi | /sdk/go/pulumi/rpc_test.go | Go | go | 6,397 | permissive | // Copyright 2016-2018, Pulumi Corporation.
//
// 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... |
1a6ebc7220821f1c4b6e349d3746cb7550a72409 | 520d5dfbecb6ca29bba31d3e4bc1c6e76f77aa09 | zaval/google-api-go-client | /managedidentities/v1/managedidentities-gen.go | Go | go | 186,337 | 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 managedidentities provides access to the Managed Service for Microsoft Active Directory API.
//
// For product documentation, see: https... |
b5fc6f00fffff374ef9c01354bb33e6406cdd640 | 9d8756e832a88b31371b1da49a1ac1da746f2611 | TimoSto/MovieRatings | /saveTrendsToDB/sqlClient/covid.go | Go | go | 1,622 | no_license | package sqlClient
import (
"database/sql"
"fmt"
"savetrends.com/apiClient"
)
type Covid struct {
WeekNr sql.NullInt64 `json:weekNr`
Cases sql.NullInt64 `json:cases`
Deaths sql.NullInt64 `json:deaths`
Recovered sql.NullInt64 `json:recovered`
}
func(client *SQLClient)ExtendOfUpdateCovidTable(stats apiClient.Cov... |
ee5f30dc5fe3606b98bc93ed0368b8ea88189739 | fd8178dd87ce27d9a3fb1332c0351e15ed253a24 | mareksuscak/cloud-builders | /gke-deploy/cmd/common/common.go | Go | go | 2,561 | permissive | /*
Copyright 2019 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 law or agreed to in wr... |
d686aa85e4a29417c065b8a8b78c0f74934173f4 | 7fa40919d377911307780500819f7d60c0f18f28 | maxlcoder/gopl | /ch6/urlvalues/main.go | Go | go | 294 | no_license | package main
import (
"fmt"
"net/url"
)
func main() {
m := url.Values{"lang": {"en"}} // 直接构造
m.Add("item", "1")
m.Add("item", "2")
fmt.Println(m.Get("lang"))
fmt.Println(m.Get("q"))
fmt.Println(m.Get("item"))
fmt.Println(m["item"])
m = nil
fmt.Println(m.Get("item"))
} |
973a35f2df952e056815e61b99281655ab898573 | bf8f0546b41d1d7c1f94c80c97fff16900a2e02c | niswat/home24-assignment | /pkg/webtool/loginform.go | Go | go | 899 | no_license | package webtool
import (
"log"
"github.com/PuerkitoBio/goquery"
)
// This functions checks whether a given web page has a login form or not
func CheckLoginForm(url string) (string, error) {
resp, err := HttpResponse(url)
if err != nil {
return "", err
}
// The client must close the response body when finish... |
c76d86ef7a95de5465491fb256316ca145f39938 | 9290e37a9fb92336a5c1ecbe74b24070e503c111 | maliqazzz/GolangMusobarPractice | /35-JSON/main.go | Go | go | 573 | no_license | package main
import (
"encoding/json"
"fmt"
)
func main() {
player1 := Player{ID: 1, Name: "Diego Costa"}
p1, err := json.Marshal(player1)
if err != nil {
fmt.Println(err.Error())
}
fmt.Println(string(p1))
//ditambahkan string agar bisa menjadi string
fmt.Println("===================")
data := []byte(`... |
496da367c5f79276a8a0cada56e5eaf2214187f8 | c8d30e0a2b683cf813de3c1af0c091efe7cd9aa6 | k-schmidt/Go_Sandbox | /ch1/dup2.go | Go | go | 645 | no_license | package main
import (
"bufio"
"fmt"
"os"
)
func main() {
counts := make(map[string]int)
files := os.Args[1:]
if len(files) == 0 {
countLines(os.Stdin, counts)
} else {
for _, arg := range files {
f, err := os.Open(arg)
if err != nil {
fmt.Fprintf(os.Stderr, "dup2: %v\n", err)
continue
}
... |
aebee4e3896f648fc37c4280742c4903295dbf9a | 7f5159fbdde6ea8558f61467840901a1a866ab8f | okn28/go-user-plugins | /uplugin/bplugin.go | Go | go | 3,660 | permissive | package uplugin
import (
"fmt"
"io/ioutil"
"math/rand"
"os"
"os/exec"
"path"
"path/filepath"
"plugin"
"reflect"
)
const (
//SourceExt const
SourceExt = ".go"
//CompiledExt const
CompiledExt = ".so"
)
// PluginLoader keeps the context needed to find where ObjPlugins and
// objects are stored.
type Plugin... |
42973ec30cf7fed4f301aa6081020282b89d5913 | f37c8f7072434e5050fc14e450aa14aa73853be6 | pvasant/ocm-sdk-go | /accountsmgmt/v1/reserved_resource_builder.go | Go | go | 5,004 | permissive | /*
Copyright (c) 2020 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... |
5c73f711a8eb89d94502fa399413662b314702d1 | 1c9bd3878d0687772ed00e43ee05f7598ee1dff8 | zaboevai/go-patterns | /Behavioral/Command/command.go | Go | go | 1,912 | permissive | // Паттерн Команда (Command)
//
package command
// Тип Command, описывает общий интерфейс для команд
type Command interface {
Execute() string
}
// Тип ToggleOnCommand, реализует команду включения тумблера
type ToggleOnCommand struct {
receiver *Receiver
}
// Выполнение команды получателем
func (self *ToggleOnCom... |
cf05b9fcd96766e0922692b1b348f8a26b855c0d | f86c06ad4e446bd68eca45d1d9eba568dea8c7d9 | cheonvi1004/open-service-broker-sacloud | /broker/handler/filter_basic_auth.go | Go | go | 1,379 | permissive | package handler
import (
"encoding/base64"
"net/http"
"strings"
log "github.com/Sirupsen/logrus"
)
func newFilterBasicAuth(username, password string) handlerFunc {
if username == "" || password == "" {
log.Warn(
`[Init] username or password is empty, disabled BASIC auth filter`)
return func(w http.Res... |
129e79555781df66a469761daa614920cd6c4e4d | ddebad5ab1ca178098d7c4c9d77933710fd71f39 | frasercobb/gomo | /prompter.go | Go | go | 1,554 | permissive | package main
import (
"fmt"
"github.com/AlecAivazis/survey/v2"
"github.com/fatih/color"
)
type Prompter struct{}
func NewPrompter() *Prompter {
return &Prompter{}
}
func (p *Prompter) AskForUpgrades(modules []Module) ([]Module, error) {
options := createSelectOptions(modules)
prompt := &survey.MultiSelect{
... |
2fa4e0de3bb6e8bec8374e17c614c6593f3716dd | e269cf1f50e24791c9588686be269227be91a2c8 | vnclouds/wag | /internal/gen/coder.go | Go | go | 919 | permissive | package gen
import (
"io"
"github.com/tsavola/wag/internal/regs"
"github.com/tsavola/wag/internal/values"
"github.com/tsavola/wag/traps"
"github.com/tsavola/wag/types"
"github.com/tsavola/wag/wasm"
)
const (
ROTableAddr = 0
WordSize = 8 // stack entry size
StackReserve = WordSize + 128 // ... |
b97ef3f040ecf78e852f91a4c9ceddc5522038b9 | 2200c153b10e99a8961dbb47d1fa8d780ee4a0f0 | ichekrygin/helm | /cmd/helm/list.go | Go | go | 5,543 | permissive | /*
Copyright The Helm 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, software
di... |
92d12f19a6eb3920f231b8f469bb2991f97e9930 | 28250efd1dff745f5c11f4eb3328290f57546a39 | RTradeLtd/go-ipfs-api | /logger_test.go | Go | go | 440 | permissive | package shell
import (
"context"
"testing"
)
func TestLogger(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
sh := NewShell(shellUrl)
logger, err := sh.GetLogs(ctx)
if err != nil {
t.Fatal(err)
}
defer func() {
if err := logger.Close(); err != nil {
t.Fatal(err)
... |
1dbe0b1dfd0e5c7582d9c185a420c2ebceaa4dd4 | 5a913c20b839b2b6cc65b5e049414cf8ce46c916 | brianredbeard/kubernetes | /test/e2e/framework/pv_util.go | Go | go | 30,724 | permissive | /*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
6c4ece9d11f6e522d3c93be1474b822ae48219fc | 6af45d3d1e85066727d3cbe1637c8229541dced1 | LCerebo/dolt | /go/cmd/dolt/commands/sql.go | Go | go | 43,466 | permissive | // Copyright 2019-2020 Liquidata, 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 agre... |
0d95e4cb6de2c97d051662e15b83a1778b24697d | 922214dff2220f3e18f81f58369013f16f7d5081 | Dingdongdang/Say-all-you-know-without-reserve | /practice/sort/heapsort_test.go | Go | go | 266 | no_license | package sort
import (
"fmt"
"math/rand"
"testing"
)
func TestHeapSort(t *testing.T) {
arr := [100]int{}
for i,_ := range arr{
arr[i] = rand.Int()%100
fmt.Printf("%d ",arr[i])
}
heapSort(&arr)
println()
for _,v := range arr{
fmt.Printf("%d ",v)
}
} |
a4463ba42f6384227d8b36085243c9ae3326fc74 | e4c9e6347a835f0b5528d0fe67b58122dd08f9bd | wilybrace/postgres-operator | /internal/apiserver/backupoptions/pgbackrestoptions.go | Go | go | 10,511 | permissive | package backupoptions
/*
Copyright 2019 - 2021 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... |
5dda446fc9f66ade0235163205cbbcfc5c4de666 | 95e9ad77508522d6155796a00b9eb68d1131e8b7 | maximilien/knfun | /vendor/github.com/IBM/go-sdk-core/core/bearer_token_authenticator.go | Go | go | 2,209 | permissive | package core
// (C) Copyright IBM Corp. 2019.
//
// 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 ... |
e2aebd972302b36a077ae80c43412753187cd19e | d1489f1aaf69c68e692cafcc89b4a33daefff7f1 | lock19960613/SCL | /Daily/sbgo/Leetcode316-去除重复字母.go | Go | go | 549 | no_license | package sbgo
//char是int32
//但byte能和uint8比较,不能和int32
func removeDuplicateLetters(s string) string {
nums := [26]int{}
for _, ch := range s {
nums[ch-'a']++
}
stk := []byte{}
used := [26]bool{}
for _, ch := range s {
if !used[ch-'a'] {
for len(stk) > 0 && byte(ch) < stk[len(stk)-1] {
last := stk[len(st... |
9a3a7537ba639d76eaa4cedb4487ffd4d7a09754 | 4a34d6b1f3dc108a552e7c2a418e342ea40aa3e5 | 2xic-archive/lnd | /cmd/lncli/routerrpc_active.go | Go | go | 217 | permissive | // +build routerrpc
package main
import "github.com/urfave/cli"
// routerCommands will return nil for non-routerrpc builds.
func routerCommands() []cli.Command {
return []cli.Command{queryMissionControlCommand}
}
|
bc452b9f1193fd452ee9c5a17af940267bdad27f | e3f1aa878c3cc1eabb460f65c94b40527adbd6ca | juetun/base-wrapper | /lib/utils/hashid.go | Go | go | 1,133 | no_license | // Package utils
package utils
import (
"github.com/juetun/base-wrapper/lib/app/app_obj"
hashids "github.com/speps/go-hashids/v2"
)
type HashIdParams struct {
Salt string
MinLength int
}
var hashIdParams *HashIdParams
func (hd *HashIdParams) SetHashIdSalt(salt string) func(*HashIdParams) interface{} {
re... |
efa13c58b10c319ed801cf249cf5ac4693c5fd0d | 6146873d0fc84360a687d0da5580ee89626bf27e | mmancuso723/origin | /pkg/sdn/node/vnids_test.go | Go | go | 5,184 | permissive | package node
import (
"testing"
"k8s.io/apimachinery/pkg/util/sets"
"github.com/openshift/origin/pkg/sdn"
)
func TestNodeVNIDMap(t *testing.T) {
vmap := newNodeVNIDMap(nil, nil)
// empty vmap
checkNotExists(t, vmap, "alpha")
checkNamespaces(t, vmap, 1, []string{})
checkAllocatedVNIDs(t, vmap, []uint32{})
... |
169f557e2f25910012f489c9f7df6ef7a697b6dd | d4283a26e803903815e803077ac7855ba710d757 | xlplbo/walk | /declarative/progressbar.go | Go | go | 1,754 | permissive | // Copyright 2012 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package declarative
import (
"github.com/xlplbo/walk"
)
type ProgressBar struct {
// Window
Accessibility Accessibility
Backgro... |
f7540e7a6e7075e9f583db63fcc81b92c94f2bb5 | dfe5a3446796949d9a990c382164ba127d463114 | gorpher/fastrouter | /fastrouter_test.go | Go | go | 12,358 | permissive | package fastrouter
import (
"bufio"
"bytes"
"fmt"
"net"
"testing"
"time"
"github.com/valyala/fasthttp"
)
func TestSplitPath(t *testing.T) {
tests := map[string][]string{
// basic
"/": {"/"},
"/a": {"/a"},
"/a/": {"/a", "/"},
"/a/b": {"/a", "/b"},
"/a/b/": {"/a", "/b", "/"... |
317e9cebfbbee39b2bddf08cd335cd54eaf55783 | ee68bedb65e981a5821a4192e6423050e2e3fc03 | Roughsketch/gsa | /src/main/gsd.go | Go | go | 2,366 | no_license | package main
import (
"disassembler"
"flag"
"fmt"
"os"
"strconv"
)
func main() {
f_rommode := flag.String("r", "", "Specifies which rommode to use (lo/hi).")
f_amode := flag.Bool("a", false, "If true, a flag will start with 16-bit.")
f_xmode := flag.Bool("x", false, "If true, x flag will start with 16-bit.")
... |
9c6b23591454407a1e66b641ef182fc40b8919fe | 6c44979bf72cbcdadf1aa283f41fb4f876070858 | jackeduardo/leetcode-answer-for-golang | /动态规划类/221. 最大正方形在(中等).go | Go | go | 859 | no_license | package main
import (
"fmt"
"leetcode-answer/Methods"
)
func main() {
matrix := [][]byte{
{'1', '0', '1', '0', '0'},
{'1', '0', '1', '1', '1'},
{'1', '1', '1', '1', '1'},
{'1', '0', '0', '1', '0'},
}
fmt.Println(maximalSquare(matrix))
}
//如果定义dp[i][j]为i,j位置的最大正方形面积会非常不方便,因为很难处理边长这个变量,所以dp[i][j]定义为最大边长
fu... |
d7c5bf4b88b6b5c874b0348705b423cd2b56dc93 | fb6a322e044c4d1b46590f634655f3a47d3d50f2 | CodingBeard/tray | /example/main.go | Go | go | 363 | permissive | package main
import (
"fmt"
"time"
"github.com/codingbeard/tray"
)
func main() {
trayIcon := tray.ClickableIcon{
IconData: iconData,
ClickHandler: func(x, y int, rightClick bool) {
fmt.Println("x", x, "y", y, "isRightClick", rightClick)
},
}
trayIcon.Initialise()
fmt.Println("Clickable Icon initialis... |
d8c66c2e853ed85f6cb8d79501de92093f21ad72 | 8d85742703defcdfe32472a267ed0b1a917465bf | 4ydx/gltext | /example/main.go | Go | go | 3,916 | permissive | package main
import (
"fmt"
"github.com/4ydx/gltext"
"github.com/4ydx/gltext/v4.1"
"github.com/go-gl/gl/v4.1-core/gl"
"github.com/go-gl/glfw/v3.2/glfw"
"github.com/go-gl/mathgl/mgl32"
"golang.org/x/image/math/fixed"
"math"
"os"
"runtime"
"time"
)
var useStrictCoreProfile = (runtime.GOOS == "darwin")
func ... |
0cc0845c85137fcf6df9ba04f6037d6c0263785b | a6191b30c3229f9fe163512a1bc8d47e0c33e7cc | mpl/grpc | /grpc/stats/stats_test.go | Go | go | 26,087 | permissive | /*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of condi... |
bb2efc91b04e4055699fae87081f34b3bb9e3819 | 7c7fed011ff723326843fde17ccbc61e2ed487a9 | hossnys/0-orchestrator | /api/node/node_api_DeleteContainer.go | Go | go | 1,491 | permissive | package node
import (
"net/http"
"github.com/gorilla/mux"
"github.com/zero-os/0-orchestrator/api/tools"
)
// DeleteContainer is the handler for DELETE /nodes/{nodeid}/containers/{containername}
// Delete Container instance
func (api NodeAPI) DeleteContainer(w http.ResponseWriter, r *http.Request) {
aysClient := ... |
595ba4be8882f21491ca16d31a506dfefc23831c | db1b6616eb6012f63c92323ada776e4bd4694d2c | erply/api-go-wrapper | /pkg/api/sales/client.go | Go | go | 218 | permissive | package sales
import (
"github.com/erply/api-go-wrapper/internal/common"
)
type (
Client struct {
*common.Client
}
)
func NewClient(client *common.Client) *Client {
cli := &Client{
client,
}
return cli
}
|
a51f355583a531f825a5312968c5f7199b2dbe11 | 5b872581c9aae3d39e8c96e1e55dc76da0a401a3 | smartadserver/prebid-server | /adapters/adview/adview_test.go | Go | go | 733 | permissive | package adview
import (
"testing"
"github.com/prebid/prebid-server/adapters/adapterstest"
"github.com/prebid/prebid-server/config"
"github.com/prebid/prebid-server/openrtb_ext"
"github.com/stretchr/testify/assert"
)
func TestJsonSamples(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderAdView, conf... |
f24a1b62ad5abba57d68ef998ec6de34be764aa9 | c9b37b1ce0c826fee04ce9ce3cf1038ab7bd814f | mantishK/xendit-go | /disbursement/params.go | Go | go | 2,429 | permissive | package disbursement
import (
"net/url"
)
// CreateParams contains parameters for Create
type CreateParams struct {
IdempotencyKey string `json:"-"`
ForUserID string `json:"-"`
ExternalID string `json:"external_id" validate:"required"`
BankCode string `json:"bank_code" validate... |
f6cb8a2cc10ef0d4862d992484305776591fc28a | 12e937c6d0d3db29cbf288d888af6b4e2d0005f2 | marton-kiss/pvc-operator | /pkg/stub/providers/aws.go | Go | go | 2,636 | permissive | package providers
import (
"errors"
"github.com/banzaicloud/pvc-operator/pkg/apis/banzaicloud/v1alpha1"
"github.com/operator-framework/operator-sdk/pkg/sdk"
"github.com/sirupsen/logrus"
"k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// AwsProvider holds i... |
085ae6e63006ea900ce09240ba9cd4f47623a804 | 5c8ee28a688294ef394fdcd75a08aee03b90f2b3 | bububa/opentaobao | /model/miniappopen/TaobaoMiniappDistributionMaterialCreateAPIResponse.go | Go | go | 1,318 | permissive | package miniappopen
import (
"encoding/xml"
"github.com/bububa/opentaobao/model"
)
// TaobaoMiniappDistributionMaterialCreateAPIResponse 小程序投放--新建投放素材 API返回值
// taobao.miniapp.distribution.material.create
//
// 为可投放的小程序,增加入口的素材信息,比如图片、引导文案等等。
type TaobaoMiniappDistributionMaterialCreateAPIResponse struct {
model.... |
34e945c27a9d0acf3c2902480e3f00c80e9688c0 | a9a911db4d016ddc196de4382fbe4e91c7011b84 | dell/gopowerstore | /nfs_test.go | Go | go | 3,659 | permissive | /*
*
* Copyright © 2020-2022 Dell Inc. or its subsidiaries. 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
*
*... |
5071ffef1ab2b52bc1d03d975d24b39748bb1102 | bda5e0a1734c0ab8f1bfd74084139aef333610c0 | mewbak/gofd | /propagator/interval/XmultYeqZ_test.go | Go | go | 2,062 | no_license | package interval
import (
"testing"
)
func xMultYeqZ_test(t *testing.T, xinit []int, yinit []int, zinit []int,
expx []int, expy []int, expz []int, expready bool) {
X, Y, Z := createXYZtestVars(xinit, yinit, zinit)
store.AddPropagator(CreateXmultYeqZ(X, Y, Z))
ready := store.IsConsistent()
ready_test(t, "XmultYe... |
efd7a710dafae43e0ea85994a8012c5f668c1c1d | bf93f0fc61c678d71c42b7f15f80110635574e21 | apache/arrow | /go/arrow/datatype_fixedwidth_test.go | Go | go | 11,287 | 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... |
2c1b1eef040405d25156b1e3cd6027ef474352d6 | 5009cc4bbd96f4fb8f93c884d1d537ac82bdecf6 | kubenext/lissio | /pkg/view/component/label_test.go | Go | go | 1,546 | permissive | /*
Copyright (c) 2019 VMware, Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package component_test
import (
"encoding/json"
"io/ioutil"
"path/filepath"
"testing"
"github.com/kubenext/lissio/pkg/view/component"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
fun... |
77be1c90a48c0147a9570d8159d6191fbd7e6edf | 13993c0b296b619447fb84d7c809218714e1cfd2 | alexitron77/singapore-mrt-api | /controllers/compute_time.go | Go | go | 959 | no_license | package controllers
// Calculate travel time based on shift timings
func ComputeTravelTime(paths [][]string, lineTimeConf map[string]int, lineChangeTime int) []int {
computedTravelTime := []int{}
for _, path := range paths {
totalTravelTime := 0
prev := path[0][:2]
for _, stn := range path {
// If the line... |
3eb0baad6475927f463022f27df83802f6d66112 | 03e8446042d436948d6eaf5deaa20af5e3db911b | uffy/mnist_example | /MNISTLoader/loader.go | Go | go | 2,930 | no_license | package MNISTLoader
import (
"encoding/binary"
"errors"
"log"
"os"
)
// ReadLabels parses input label file from given path and returns list of MNIST labels and number of distinct labels
func ReadLabels(path string) ([]float64, int, error) {
f, err := os.Open(path)
if err != nil {
return nil, 0, err
}
var m... |
fe44df1031a97f86cdeffeb9d2c8f53c58a57550 | 265f1b457b78d274e39b47cb47b6f394f8469532 | lawrsp/wechat | /config/config.go | Go | go | 310 | permissive | package config
// AppType
type AppType string
const (
PlatformMP AppType = "mp"
PlatformMiniProgram AppType = "minip"
PlatformMiniGame AppType = "minig"
)
type AppConfig struct {
AppType AppType `json:"app_type"`
AppID string `json:"app_id"`
AppSecret string `json:"app_secret"`
}
|
a35f274fde914aefa69fe5a897f8b1eb1e363718 | c23feaaa0b2eeeea7d1e2f1dad2fbaa31d15e8ef | Cloudxtreme/docker-commander | /tests/integration/swarm/httpClient_test.go | Go | go | 1,063 | permissive | package restClient
import (
"testing"
"github.com/sayden/docker-commander/config"
"github.com/sayden/docker-commander/swarm"
)
func TestGetHosts(t *testing.T) {
h := swarm.HTTPClient{Host: config.SWARM_MANAGER_DEVELOPMENT}
r, err := h.ListInfo()
if err != nil {
t.Fail()
}
if r.DriverStatus == nil {
t.F... |
a36737a59beca7918a8dc54952afef69da2e9e68 | bd40372480839cc564209159ef8976f5ee363bcb | nnn-gif/minio | /object-handlers.go | Go | go | 33,025 | permissive | /*
* Minio Cloud Storage, (C) 2015 Minio, 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 la... |
b46f1493092a2c95cb9e1b0daab93fb0193e5381 | 5c9969aa66358ab35fa6e942d3e6707c23100e93 | mattn/entgo-bbs | /main.go | Go | go | 1,590 | permissive | package main
import (
"context"
_ "embed"
"flag"
"log"
"net/http"
"strings"
"github.com/labstack/echo"
"github.com/mattn/entgo-bbs/ent"
"github.com/mattn/entgo-bbs/ent/entry"
"github.com/mattn/go-slim"
_ "github.com/mattn/go-sqlite3"
)
type Payload struct {
Content string `json:"content"`
}
//go:embed ... |
d1ec04b14b0a5bd37b6696465ce7514ea33c2a44 | 39585d02c3d0f749a32a9c01f5a47163a07090dd | torkelrogstad/cu | /cmd/gencublas/binding.go | Go | go | 10,258 | permissive | package main
// binding.go is copied from gonum/internal and provides helpers for building autogenerated cgo bindings.
import (
"bytes"
"fmt"
"go/ast"
"go/parser"
"go/token"
"log"
"strings"
"text/template"
"github.com/cznic/cc"
"github.com/cznic/xc"
bg "github.com/gorgonia/bindgen"
)
var goTypes = map[bg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.